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)

Location:
trunk/psLib/test/astronomy
Files:
4 edited

Legend:

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

    r3708 r3712  
    2323 *  @author  Ross Harman, MHPCC
    2424 *
    25  *  @version $Revision: 1.24 $  $Name: not supported by cvs2svn $
    26  *  @date  $Date: 2005-04-19 00:17:06 $
     25 *  @version $Revision: 1.25 $  $Name: not supported by cvs2svn $
     26 *  @date  $Date: 2005-04-19 02:13:53 $
    2727 *
    2828 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4444    testTime = (psTime*)psAlloc(sizeof(psTime));
    4545    testTime->sec = 1090434144;
    46     testTime->usec = 272044;
     46    testTime->nsec = 272044000;
    4747    testTime->type = PS_TIME_TAI;
    4848
     
    5757    // Test B - Print test time
    5858    printPositiveTestHeader(stdout,"psTime", "Print test time");
    59     printf("Test time: Seconds = %lld Microseconds = %u\n",
     59    printf("Test time: Seconds = %lld Nanoseconds = %u\n",
    6060           (long long int)testTime->sec,
    61            testTime->usec);
     61           testTime->nsec);
    6262    printFooter(stdout, "psTime", "Print test time", true);
    6363
     
    7979    psTime *timeD = NULL;
    8080    timeD = psTimeFromISO(isoString);
    81     printf("psTime: Seconds = %lld Microseconds = %u\n",
     81    printf("psTime: Seconds = %lld Nanoseconds = %u\n",
    8282           (long long int)timeD->sec,
    83            timeD->usec);
     83           timeD->nsec);
    8484    psFree(isoString);
    8585    psFree(timeD);
     
    9292    timeE = (psTime*)psAlloc(sizeof(psTime));
    9393    timeE->sec = 1090434144;
    94     timeE->usec = 272044;
     94    timeE->nsec = 272044000;
    9595    timeE->type = PS_TIME_TAI;
    9696    timeE = psTimeConvert(timeE, PS_TIME_UTC);
    9797    psFree(timeE);
    98     printf("psTime: Seconds = %lld Microseconds = %u\n",
     98    printf("psTime: Seconds = %lld Nanoseconds = %u\n",
    9999           (long long int)timeE->sec,
    100            timeE->usec);
     100           timeE->nsec);
    101101    printFooter(stdout, "psTime", "Convert psTime time to UTC time", true);
    102102
     
    107107    timeF = (psTime*)psAlloc(sizeof(psTime));
    108108    timeF->sec = 1090434112;
    109     timeF->usec = 272044;
     109    timeF->nsec = 272044000;
    110110    timeF->type = PS_TIME_UTC;
    111111    timeF = psTimeConvert(timeF, PS_TIME_TAI);
    112112    psFree(timeF);
    113     printf("psTime: Seconds = %lld Microseconds = %u\n",
     113    printf("psTime: Seconds = %lld Nanoseconds = %u\n",
    114114           (long long int)timeF->sec,
    115            timeF->usec);
     115           timeF->nsec);
    116116    printFooter(stdout, "psTime", "Convert UTC time to psTime", true);
    117117
     
    129129    psTime *timeH = NULL;
    130130    timeH = psTimeFromMJD(mjdTime);
    131     printf("psTime: Seconds = %lld Microseconds = %u\n",
     131    printf("psTime: Seconds = %lld Nanoseconds = %u\n",
    132132           (long long int)timeH->sec,
    133            timeH->usec);
     133           timeH->nsec);
    134134    psFree(timeH);
    135135    printFooter(stdout, "psTime", "Convert MJD time to psTime", true);
     
    148148    psTime *timeJ = NULL;
    149149    timeJ = psTimeFromJD(jdTime);
    150     printf("psTime: Seconds = %lld Microseconds = %u\n",
     150    printf("psTime: Seconds = %lld Nanoseconds = %u\n",
    151151           (long long int)timeJ->sec,
    152            timeJ->usec);
     152           timeJ->nsec);
    153153    psFree(timeJ);
    154154    printFooter(stdout, "psTime", "Convert JD time to psTime", true);
     
    169169    psTime *timeL = NULL;
    170170    timeL = psTimeFromTimeval(&timevalTime);
    171     printf("psTime: Seconds = %lld Microseconds = %u\n",
     171    printf("psTime: Seconds = %lld Nanoseconds = %u\n",
    172172           (long long int)timeL->sec,
    173            timeL->usec);
     173           timeL->nsec);
    174174    psFree(timeL);
    175175    printFooter(stdout, "psTime", "Convert timeval time to psTime", true);
     
    194194    psTime *timeN = NULL;
    195195    timeN = psTimeFromTM(tmTime);
    196     printf("psTime: Seconds = %lld Microseconds = %u\n",
     196    printf("psTime: Seconds = %lld Nanoseconds = %u\n",
    197197           (long long int)timeN->sec,
    198            timeN->usec);
     198           timeN->nsec);
    199199    psFree(timeN);
    200200    psFree(tmTime);
  • 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) {
  • trunk/psLib/test/astronomy/verified/tst_psTime_01.stdout

    r2746 r3712  
    1414\**********************************************************************************/
    1515
    16 Test time: Seconds = 1090434144 Microseconds = 272044
     16Test time: Seconds = 1090434144 Nanoseconds = 272044000
    1717
    1818---> TESTPOINT PASSED (psTime{Print test time} | tst_psTime_01.c)
     
    3434\**********************************************************************************/
    3535
    36 psTime: Seconds = 1090434144 Microseconds = 272000
     36psTime: Seconds = 1090434144 Nanoseconds = 272000000
    3737
    3838---> TESTPOINT PASSED (psTime{Convert ISO time to psTime} | tst_psTime_01.c)
     
    4444\**********************************************************************************/
    4545
    46 psTime: Seconds = 1090434112 Microseconds = 272044
     46psTime: Seconds = 1090434112 Nanoseconds = 272044000
    4747
    4848---> TESTPOINT PASSED (psTime{Convert psTime time to UTC time} | tst_psTime_01.c)
     
    5454\**********************************************************************************/
    5555
    56 psTime: Seconds = 1090434144 Microseconds = 272044
     56psTime: Seconds = 1090434144 Nanoseconds = 272044000
    5757
    5858---> TESTPOINT PASSED (psTime{Convert UTC time to psTime} | tst_psTime_01.c)
     
    7474\**********************************************************************************/
    7575
    76 psTime: Seconds = 1090434144 Microseconds = 272043
     76psTime: Seconds = 1090434144 Nanoseconds = 272043704
    7777
    7878---> TESTPOINT PASSED (psTime{Convert MJD time to psTime} | tst_psTime_01.c)
     
    9494\**********************************************************************************/
    9595
    96 psTime: Seconds = 1090434144 Microseconds = 272048
     96psTime: Seconds = 1090434144 Nanoseconds = 272048711
    9797
    9898---> TESTPOINT PASSED (psTime{Convert JD time to psTime} | tst_psTime_01.c)
     
    114114\**********************************************************************************/
    115115
    116 psTime: Seconds = 1090434144 Microseconds = 272044
     116psTime: Seconds = 1090434144 Nanoseconds = 272044000
    117117
    118118---> TESTPOINT PASSED (psTime{Convert timeval time to psTime} | tst_psTime_01.c)
     
    140140\**********************************************************************************/
    141141
    142 psTime: Seconds = 1090434144 Microseconds = 0
     142psTime: Seconds = 1090434144 Nanoseconds = 0
    143143
    144144---> TESTPOINT PASSED (psTime{Convert tm time to psTime} | tst_psTime_01.c)
  • trunk/psLib/test/astronomy/verified/tst_psTime_03.stdout

    r2966 r3712  
    2828/***************************** TESTPOINT ******************************************\
    2929*             TestFile: tst_psTime_03.c                                            *
    30 *            TestPoint: psTime{Test D - Subtact two times with underflow in microseconds} *
     30*            TestPoint: psTime{Test D - Subtact two times with underflow in nanoseconds} *
    3131*             TestType: Positive                                                   *
    3232\**********************************************************************************/
    3333
    3434
    35 ---> TESTPOINT PASSED (psTime{Test D - Subtact two times with underflow in microseconds} | tst_psTime_03.c)
     35---> TESTPOINT PASSED (psTime{Test D - Subtact two times with underflow in nanoseconds} | tst_psTime_03.c)
    3636
    3737/***************************** TESTPOINT ******************************************\
Note: See TracChangeset for help on using the changeset viewer.