IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 18, 2005, 4:13:53 PM (21 years ago)
Author:
evanalst
Message:

Modify the psTime data structure. (SDR-13)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astronomy/tst_psTime_03.c

    r3705 r3712  
    1919 *  @author  Ross Harman, MHPCC
    2020 *
    21  *  @version $Revision: 1.15 $  $Name: not supported by cvs2svn $
    22  *  @date  $Date: 2005-04-18 23:30:54 $
     21 *  @version $Revision: 1.16 $  $Name: not supported by cvs2svn $
     22 *  @date  $Date: 2005-04-19 02:13:53 $
    2323 *
    2424 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3030
    3131#define PRINT_TIME(TEXT,TIME) \
    32 printf("%s Seconds = %lld Microseconds = %u\n", TEXT, (long long int)TIME->sec, TIME->usec);
     32printf("%s Seconds = %lld Nanoseconds = %u\n", TEXT, (long long int)TIME->sec, TIME->nsec);
    3333
    3434psS32 main(psS32 argc, char* argv[])
     
    4444    time1a = psTimeAlloc(PS_TIME_TAI);
    4545    time1a->sec  = 1;
    46     time1a->usec = 111111;
     46    time1a->nsec = 111111000;
    4747    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);
    5050    }
    5151    printFooter(stdout, "psTime", "Test A - Add two times", true);
    5252
    5353
    54     // Test B - Add two times with overflow in microseconds
     54    // Test B - Add two times with overflow in nanoseconds
    5555    printPositiveTestHeader(stdout, "psTime", "Test B - Add two times with overflow in microseconds");
    5656    psTime *time2a = NULL;
     
    5959    time2a = psTimeAlloc(PS_TIME_TAI);
    6060    time2a->sec  = 6;
    61     time2a->usec = 600001;
     61    time2a->nsec = 600001000;
    6262    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);
    6565    }
    6666    printFooter(stdout, "psTime", "Test B - Add two times with overflow in microseconds", true);
     
    7474    time3a = psTimeAlloc(PS_TIME_TAI);
    7575    time3a->sec  = 3;
    76     time3a->usec = 333333;
     76    time3a->nsec = 333333000;
    7777    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);
    8080    }
    8181    printFooter(stdout, "psTime", "Test C - Subtract two times", true);
    8282
    8383
    84     // Test D - Subtact two times with underflow in microseconds
    85     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");
    8686    psTime *time4a = NULL;
    8787    psF64 time4b = -2.000003;
     
    8989    time4a = psTimeAlloc(PS_TIME_TAI);
    9090    time4a->sec  = 5;
    91     time4a->usec = 1;
     91    time4a->nsec = 1000;
    9292    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);
    9797
    9898
     
    105105    time5b = psTimeAlloc(PS_TIME_TAI);
    106106    time5a->sec  = 8;
    107     time5a->usec = 8;
     107    time5a->nsec = 8000;
    108108    time5b->sec  = 7;
    109     time5b->usec = 7;
     109    time5b->nsec = 7000;
    110110    timeOut5 = psTimeDelta(time5a, time5b);
    111111    if(fabs(timeOut5-1.000001) > FLT_EPSILON) {
     
    123123    time6b = psTimeAlloc(PS_TIME_TAI);
    124124    time6a->sec  = 8;
    125     time6a->usec = 1;
     125    time6a->nsec = 1000;
    126126    time6b->sec  = 7;
    127     time6b->usec = 7;
     127    time6b->nsec = 7000;
    128128    timeOut6 = psTimeDelta(time6a, time6b);
    129129    if(fabs(timeOut6-0.999994) > FLT_EPSILON) {
     
    140140    time20b = psTimeAlloc(PS_TIME_UTC);
    141141    time20a->sec = 1090434113;
    142     time20a->usec = 272044;
     142    time20a->nsec = 272044000;
    143143    time20b->sec = 1090434112;
    144     time20b->usec = 272044;
     144    time20b->nsec = 272044000;
    145145    timeOut20 = psTimeDelta(time20a, time20b);
    146146    if(fabs(timeOut20-1.000000000) > FLT_EPSILON) {
Note: See TracChangeset for help on using the changeset viewer.