Changeset 3712 for trunk/psLib/test/astronomy/tst_psTime_03.c
- Timestamp:
- Apr 18, 2005, 4:13:53 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astronomy/tst_psTime_03.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psTime_03.c
r3705 r3712 19 19 * @author Ross Harman, MHPCC 20 20 * 21 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $22 * @date $Date: 2005-04-1 8 23:30:54$21 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 22 * @date $Date: 2005-04-19 02:13:53 $ 23 23 * 24 24 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 30 30 31 31 #define PRINT_TIME(TEXT,TIME) \ 32 printf("%s Seconds = %lld Microseconds = %u\n", TEXT, (long long int)TIME->sec, TIME->usec);32 printf("%s Seconds = %lld Nanoseconds = %u\n", TEXT, (long long int)TIME->sec, TIME->nsec); 33 33 34 34 psS32 main(psS32 argc, char* argv[]) … … 44 44 time1a = psTimeAlloc(PS_TIME_TAI); 45 45 time1a->sec = 1; 46 time1a-> usec = 111111;46 time1a->nsec = 111111000; 47 47 timeOut1 = psTimeMath(time1a, time1b); 48 if(timeOut1->sec!=2 && timeOut1-> usec!=222222) {49 printf("ERROR: Incorrect time, %lld:%u. Expected 2:222222 \n",(long long int)timeOut1->sec, timeOut1->usec);48 if(timeOut1->sec!=2 && timeOut1->nsec!=222222000) { 49 printf("ERROR: Incorrect time, %lld:%u. Expected 2:222222000\n",(long long int)timeOut1->sec, timeOut1->nsec); 50 50 } 51 51 printFooter(stdout, "psTime", "Test A - Add two times", true); 52 52 53 53 54 // Test B - Add two times with overflow in microseconds54 // Test B - Add two times with overflow in nanoseconds 55 55 printPositiveTestHeader(stdout, "psTime", "Test B - Add two times with overflow in microseconds"); 56 56 psTime *time2a = NULL; … … 59 59 time2a = psTimeAlloc(PS_TIME_TAI); 60 60 time2a->sec = 6; 61 time2a-> usec = 600001;61 time2a->nsec = 600001000; 62 62 timeOut2 = psTimeMath(time2a, time2b); 63 if(timeOut2->sec!=12 && timeOut2-> usec!=100002) {64 printf("ERROR: Incorrect time, %lld:%u. Expected 12:100002 \n",(long long int)timeOut2->sec, timeOut2->usec);63 if(timeOut2->sec!=12 && timeOut2->nsec!=100002000) { 64 printf("ERROR: Incorrect time, %lld:%u. Expected 12:100002000\n",(long long int)timeOut2->sec, timeOut2->nsec); 65 65 } 66 66 printFooter(stdout, "psTime", "Test B - Add two times with overflow in microseconds", true); … … 74 74 time3a = psTimeAlloc(PS_TIME_TAI); 75 75 time3a->sec = 3; 76 time3a-> usec = 333333;76 time3a->nsec = 333333000; 77 77 timeOut3 = psTimeMath(time3a, time3b); 78 if(timeOut3->sec!=2 && timeOut3-> usec!=222222) {79 printf("ERROR: Incorrect time, %lld:%u. Expected 2:222222 \n",(long long int)timeOut3->sec, timeOut3->usec);78 if(timeOut3->sec!=2 && timeOut3->nsec!=222222000) { 79 printf("ERROR: Incorrect time, %lld:%u. Expected 2:222222000\n",(long long int)timeOut3->sec, timeOut3->nsec); 80 80 } 81 81 printFooter(stdout, "psTime", "Test C - Subtract two times", true); 82 82 83 83 84 // Test D - Subtact two times with underflow in microseconds85 printPositiveTestHeader(stdout, "psTime", "Test D - Subtact two times with underflow in microseconds");84 // Test D - Subtact two times with underflow in nanoseconds 85 printPositiveTestHeader(stdout, "psTime", "Test D - Subtact two times with underflow in nanoseconds"); 86 86 psTime *time4a = NULL; 87 87 psF64 time4b = -2.000003; … … 89 89 time4a = psTimeAlloc(PS_TIME_TAI); 90 90 time4a->sec = 5; 91 time4a-> usec = 1;91 time4a->nsec = 1000; 92 92 timeOut4 = psTimeMath(time4a, time4b); 93 if(timeOut4->sec!=2 && timeOut4-> usec!=999997) {94 printf("ERROR: Incorrect time, %lld:%u. Expected 2:999997 \n",(long long int)timeOut4->sec, timeOut4->usec);95 } 96 printFooter(stdout, "psTime", "Test D - Subtact two times with underflow in microseconds", true);93 if(timeOut4->sec!=2 && timeOut4->nsec!=999997000) { 94 printf("ERROR: Incorrect time, %lld:%u. Expected 2:999997000\n",(long long int)timeOut4->sec, timeOut4->nsec); 95 } 96 printFooter(stdout, "psTime", "Test D - Subtact two times with underflow in nanoseconds", true); 97 97 98 98 … … 105 105 time5b = psTimeAlloc(PS_TIME_TAI); 106 106 time5a->sec = 8; 107 time5a-> usec = 8;107 time5a->nsec = 8000; 108 108 time5b->sec = 7; 109 time5b-> usec = 7;109 time5b->nsec = 7000; 110 110 timeOut5 = psTimeDelta(time5a, time5b); 111 111 if(fabs(timeOut5-1.000001) > FLT_EPSILON) { … … 123 123 time6b = psTimeAlloc(PS_TIME_TAI); 124 124 time6a->sec = 8; 125 time6a-> usec = 1;125 time6a->nsec = 1000; 126 126 time6b->sec = 7; 127 time6b-> usec = 7;127 time6b->nsec = 7000; 128 128 timeOut6 = psTimeDelta(time6a, time6b); 129 129 if(fabs(timeOut6-0.999994) > FLT_EPSILON) { … … 140 140 time20b = psTimeAlloc(PS_TIME_UTC); 141 141 time20a->sec = 1090434113; 142 time20a-> usec = 272044;142 time20a->nsec = 272044000; 143 143 time20b->sec = 1090434112; 144 time20b-> usec = 272044;144 time20b->nsec = 272044000; 145 145 timeOut20 = psTimeDelta(time20a, time20b); 146 146 if(fabs(timeOut20-1.000000000) > FLT_EPSILON) {
Note:
See TracChangeset
for help on using the changeset viewer.
