IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1615


Ignore:
Timestamp:
Aug 24, 2004, 3:38:48 PM (22 years ago)
Author:
harman
Message:

Updated psTime for new version of SDRS

Location:
trunk/psLib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psCoord.c

    r1532 r1615  
    33*  @brief Contains basic coordinate transformation definitions and operations
    44*
    5 *  This file defines the basic types for astronomical coordinate 
     5*  This file defines the basic types for astronomical coordinate
    66*  transformation
    77*
     
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-13 23:43:29 $
     12*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-25 01:38:30 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    196196psSphereTransform* psSphereTransformICRStoEcliptic(psTime time)
    197197{
    198     struct tm *tmTime = psTimeToTM(time);
     198    struct tm *tmTime = psTimeToTM(&time);
    199199    double year = (double)(1900 + tmTime->tm_year);
    200200    double T = year / 100.0;
     
    208208psSphereTransform* psSphereTransformEcliptictoICRS(psTime time)
    209209{
    210     struct tm *tmTime = psTimeToTM(time);
     210    struct tm *tmTime = psTimeToTM(&time);
    211211    double year = (double)(1900 + tmTime->tm_year);
    212212    double T = year / 100.0;
  • trunk/psLib/src/astronomy/psCoord.c

    r1532 r1615  
    33*  @brief Contains basic coordinate transformation definitions and operations
    44*
    5 *  This file defines the basic types for astronomical coordinate 
     5*  This file defines the basic types for astronomical coordinate
    66*  transformation
    77*
     
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-13 23:43:29 $
     12*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-25 01:38:30 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    196196psSphereTransform* psSphereTransformICRStoEcliptic(psTime time)
    197197{
    198     struct tm *tmTime = psTimeToTM(time);
     198    struct tm *tmTime = psTimeToTM(&time);
    199199    double year = (double)(1900 + tmTime->tm_year);
    200200    double T = year / 100.0;
     
    208208psSphereTransform* psSphereTransformEcliptictoICRS(psTime time)
    209209{
    210     struct tm *tmTime = psTimeToTM(time);
     210    struct tm *tmTime = psTimeToTM(&time);
    211211    double year = (double)(1900 + tmTime->tm_year);
    212212    double T = year / 100.0;
  • trunk/psLib/test/astronomy/tst_psTime_01.c

    r1406 r1615  
    2121 *  @author  Ross Harman, MHPCC
    2222 *
    23  *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
    24  *  @date  $Date: 2004-08-06 22:34:05 $
     23 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
     24 *  @date  $Date: 2004-08-25 01:38:42 $
    2525 *
    2626 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434int main(int argc, char* argv[])
    3535{
    36     psTime time;
    37     psTime testTime;
    38     char *testString = "2004/07/21,18:22:24.272";
     36    psTime *time;
     37    psTime *testTime;
     38    char *testString = "2004-07-21T18:22:24.272Z";
     39    time = (psTime*)psAlloc(sizeof(psTime));
    3940
    4041    // Test time was taken at July 21, 2004 at 18:22:24.272044
    41     testTime.tv_sec = 1090434144;
    42     testTime.tv_usec = 272044;
     42    testTime = (psTime*)psAlloc(sizeof(psTime));
     43    testTime->sec = 1090434144;
     44    testTime->usec = 272044;
     45    testTime->type = PS_TIME_TAI;
    4346
    4447
    4548    // Test A - Get current TAI time
    4649    printPositiveTestHeader(stdout,"psTime", "Get current TAI time");
    47     time = psTimeGetTime();
     50    time = psTimeGetTime(PS_TIME_TAI);
    4851    printFooter(stdout, "psTime", "Get current TAI time", true);
    4952
     
    5154    //Test B - Print test time
    5255    printPositiveTestHeader(stdout,"psTime", "Print test time");
    53     printf("Test time: Seconds = %ld Microseconds = %ld\n", (long)testTime.tv_sec, (long)testTime.tv_usec);
     56    printf("Test time: Seconds = %ld Microseconds = %ld\n", (long)testTime->sec, (long)testTime->usec);
    5457    printFooter(stdout, "psTime", "Print test time", true);
    5558
     
    7073    printPositiveTestHeader(stdout,"psTime", "Convert ISO time to psTime");
    7174    time = psISOToTime(isoString);
    72     printf("psTime: Seconds = %ld Microseconds = %ld\n", (long)time.tv_sec, (long)time.tv_usec);
     75    printf("psTime: Seconds = %lld Microseconds = %d\n", (psS64)time->sec, (psU32)time->usec);
    7376    psFree(isoString);
    7477    printFooter(stdout, "psTime", "Convert ISO time to psTime", true);
    7578
    7679
    77     // Test E - Convert psTime to UTC time
     80    // Test E - Convert TAI to UTC time
    7881    printPositiveTestHeader(stdout,"psTime", "Convert psTime time to UTC time");
    79     time = psTimeToUTC(testTime);
    80     printf("psTime: Seconds = %ld Microseconds = %ld\n", (long)time.tv_sec, (long)time.tv_usec);
     82    time = psTimeConvert(testTime, PS_TIME_UTC);
     83    printf("psTime: Seconds = %lld Microseconds = %d\n", (psS64)time->sec, (psU32)time->usec);
    8184    printFooter(stdout, "psTime", "Convert psTime time to UTC time", true);
    8285
     
    8487    // Test F - Convert UTC time to psTime
    8588    printPositiveTestHeader(stdout,"psTime", "Convert UTC time to psTime");
    86     time = psUTCToTime(time);
    87     printf("psTime: Seconds = %ld Microseconds = %ld\n", (long)time.tv_sec, (long)time.tv_usec);
     89    time->type = PS_TIME_UTC;
     90    time = psTimeConvert(time, PS_TIME_TAI);
     91    printf("psTime: Seconds = %lld Microseconds = %d\n", (psS64)time->sec, (psU32)time->usec);
    8892    printFooter(stdout, "psTime", "Convert UTC time to psTime", true);
    8993
     
    100104    printPositiveTestHeader(stdout,"psTime", "Convert MJD time to psTime");
    101105    time = psMJDToTime(mjdTime);
    102     printf("psTime: Seconds = %ld Microseconds = %ld\n", (long)time.tv_sec, (long)time.tv_usec);
     106    printf("psTime: Seconds = %lld Microseconds = %d\n", (psS64)time->sec, (psU32)time->usec);
    103107    printFooter(stdout, "psTime", "Convert MJD time to psTime", true);
    104108
     
    115119    printPositiveTestHeader(stdout,"psTime", "Convert JD time to psTime");
    116120    time = psJDToTime(jdTime);
    117     printf("psTime: Seconds = %ld Microseconds = %ld\n", (long)time.tv_sec, (long)time.tv_usec);
     121    printf("psTime: Seconds = %lld Microseconds = %d\n", (psS64)time->sec, (psU32)time->usec);
    118122    printFooter(stdout, "psTime", "Convert JD time to psTime", true);
    119123
     
    130134    printPositiveTestHeader(stdout,"psTime", "Convert timeval time to psTime");
    131135    time = psTimevalToTime(&timevalTime);
    132     printf("psTime: Seconds = %ld Microseconds = %ld\n", (long)time.tv_sec, (long)time.tv_usec);
     136    printf("psTime: Seconds = %lld Microseconds = %d\n", (psS64)time->sec, (psU32)time->usec);
    133137    printFooter(stdout, "psTime", "Convert timeval time to psTime", true);
    134138
     
    151155    printPositiveTestHeader(stdout, "psTime", "Convert tm time to psTime");
    152156    time = psTMToTime(tmTime);
    153     printf("psTime: Seconds = %ld Microseconds = %ld\n", (long)time.tv_sec, (long)time.tv_usec);
     157    printf("psTime: Seconds = %lld Microseconds = %d\n", (psS64)time->sec, (psU32)time->usec);
    154158    printFooter(stdout, "psTime", "Convert tm time to psTime", true);
    155159
  • trunk/psLib/test/astronomy/tst_psTime_02.c

    r1406 r1615  
    44 *
    55 *  This test driver contains the following tests for psTime:
    6  *     A) Attempt to use negative seconds
    7  *     B) Attempt to use negative microseconds
    8  *     C) Attempt to use negative time
    9  *     D) Incorrect ISO time data
    10  *     E) Attempt to use null timeval
    11  *     F) Incorrect timeval time data
     6 *     A) Incorrect ISO time data
     7 *     B) Attempt to use null timeval
    128 *
    139 *  @author  Ross Harman, MHPCC
    1410 *
    15  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    16  *  @date  $Date: 2004-08-06 22:34:05 $
     11 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     12 *  @date  $Date: 2004-08-25 01:38:48 $
    1713 *
    1814 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2521int main(int argc, char* argv[])
    2622{
    27     psTime testTime;
    28     struct timeval timevalTime;
    2923
    30 
    31     // Test A - Attempt to use negative seconds
    32     testTime.tv_sec = -1;
    33     testTime.tv_usec = 1;
    34     timevalTime.tv_sec = -1;
    35     timevalTime.tv_usec = 1;
    36     printNegativeTestHeader(stdout,"psTime", "Attempt to use negative seconds",
    37                             "Negative seconds are not allowed: -1", 0);
    38     psTimeToISO(testTime);
    39     psTimeToUTC(testTime);
    40     psUTCToTime(testTime);
    41     psTimeToMJD(testTime);
    42     psTimeToJD(testTime);
    43     psTimeToTimeval(testTime);
    44     psTimevalToTime(&timevalTime);
    45     psTimeToTM(testTime);
    46     printFooter(stdout, "psTime", "Attempt to use negative seconds", true);
    47 
    48 
    49     // Test B - Attempt to use negative microseconds
    50     testTime.tv_sec = 1;
    51     testTime.tv_usec = -1;
    52     timevalTime.tv_sec = 1;
    53     timevalTime.tv_usec = -1;
    54     printNegativeTestHeader(stdout,"psTime", "Attempt to use negative microseconds",
    55                             "Negative microseconds are not allowed: -1", 0);
    56     psTimeToISO(testTime);
    57     psTimeToUTC(testTime);
    58     psUTCToTime(testTime);
    59     psTimeToMJD(testTime);
    60     psTimeToJD(testTime);
    61     psTimeToTimeval(testTime);
    62     psTimevalToTime(&timevalTime);
    63     psTimeToTM(testTime);
    64     printFooter(stdout, "psTime", "Attempt to use negative microseconds", true);
    65 
    66 
    67     // Test C - Attempt to use negative time
    68     printNegativeTestHeader(stdout,"psTime", "Attempt to use negative time",
    69                             "Negative time is not allowed: -1.000000", 0);
    70     psJDToTime(-1.0);
    71     psMJDToTime(-1.0);
    72     printFooter(stdout, "psTime", "Attempt to use negative time", true);
    73 
    74 
    75     // Test D - Incorrect ISO time data
     24    // Test A - Incorrect ISO time data
    7625    printNegativeTestHeader(stdout,"psTime", "Incorrect ISO time data", "Time not allowed", 0);
    77     psISOToTime("1800/2/2,12:12:12.122");
    78     psISOToTime("2004/-2/2,12:12:12.122");
    79     psISOToTime("2004/2/-2,12:12:12.122");
    80     psISOToTime("2004/2/2,-12:12:12.122");
    81     psISOToTime("2004/2/2,12:-12:12.122");
    82     psISOToTime("2004/2/2,12:12:-12.122");
    83     psISOToTime("2004/2/2,12:12:12.-122");
     26    psISOToTime("2004-99-21T18:22:24.272Z");
     27    psISOToTime("2004-07-99T18:22:24.272Z");
     28    psISOToTime("2004-07-21T99:22:24.272Z");
     29    psISOToTime("2004-07-21T18:99:24.272Z");
     30    psISOToTime("2004-07-21T18:22:99.272Z");
     31    psISOToTime("2004-07-21T18:22:24.-999Z");
    8432    printFooter(stdout, "psTime", "Incorrect ISO time data", true);
    8533
    8634
    87     // Test E - Attempt to use null timeval
     35    // Test B - Attempt to use null timeval
    8836    printNegativeTestHeader(stdout,"psTime", "Attempt to use null timeval",
    8937                            "Null value for timeval arg not allowed", 0);
     
    9139    printFooter(stdout, "psTime", "Attempt to use null timeval", true);
    9240
    93 
    94     // Test F - Incorrect timeval time data
    95     printNegativeTestHeader(stdout,"psTime", "Incorrect timeval time data", "Time not allowed", 0);
    96     struct tm tmTime;
    97     tmTime.tm_year = -2;
    98     tmTime.tm_mon  = 2;
    99     tmTime.tm_mday = 2;
    100     tmTime.tm_hour = 2;
    101     tmTime.tm_min  = 2;
    102     tmTime.tm_sec  = 2;
    103     psTMToTime(&tmTime);
    104     tmTime.tm_year = 100;
    105     tmTime.tm_mon  = -2;
    106     psTMToTime(&tmTime);
    107     tmTime.tm_mon  = 2;
    108     tmTime.tm_mday = -2;
    109     psTMToTime(&tmTime);
    110     tmTime.tm_hour = -2;
    111     tmTime.tm_mday = 2;
    112     psTMToTime(&tmTime);
    113     tmTime.tm_hour = 2;
    114     tmTime.tm_min = -2;
    115     psTMToTime(&tmTime);
    116     tmTime.tm_min = 2;
    117     tmTime.tm_sec = -2;
    118     psTMToTime(&tmTime);
    119     printFooter(stdout, "psTime", "Incorrect timeval time data", true);
    120 
    12141    return 0;
    12242}
Note: See TracChangeset for help on using the changeset viewer.