IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2749


Ignore:
Timestamp:
Dec 17, 2004, 10:48:47 AM (22 years ago)
Author:
harman
Message:

Corrected minor math error

Location:
trunk/psLib
Files:
3 edited

Legend:

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

    r2744 r2749  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-12-17 02:22:02 $
     12 *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-12-17 20:47:08 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    758758    PS_PTR_CHECK_NULL(time2,0);
    759759    PS_INT_CHECK_RANGE(time1->usec,0,1e6-1,0);
    760     PS_INT_CHECK_RANGE(time1->usec,0,1e6-1,0);
    761 
    762     diff = abs(psTimeGetTAIDelta((psTime*)time1)-psTimeGetTAIDelta((psTime*)time2));
     760    PS_INT_CHECK_RANGE(time2->usec,0,1e6-1,0);
     761    diff = abs((psS64)psTimeGetTAIDelta((psTime*)time1)-(psS64)psTimeGetTAIDelta((psTime*)time2));
    763762
    764763    return diff;
  • trunk/psLib/src/astronomy/psTime.c

    r2744 r2749  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-12-17 02:22:02 $
     12 *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-12-17 20:47:08 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    758758    PS_PTR_CHECK_NULL(time2,0);
    759759    PS_INT_CHECK_RANGE(time1->usec,0,1e6-1,0);
    760     PS_INT_CHECK_RANGE(time1->usec,0,1e6-1,0);
    761 
    762     diff = abs(psTimeGetTAIDelta((psTime*)time1)-psTimeGetTAIDelta((psTime*)time2));
     760    PS_INT_CHECK_RANGE(time2->usec,0,1e6-1,0);
     761    diff = abs((psS64)psTimeGetTAIDelta((psTime*)time1)-(psS64)psTimeGetTAIDelta((psTime*)time2));
    763762
    764763    return diff;
  • trunk/psLib/test/astronomy/tst_psTime_03.c

    r2725 r2749  
    55 *
    66 *  This test driver contains the following tests for psTime:
    7  *     Test A - Add two times
    8  *     Test B - Subtact two times
    9  *     Test C - Delta two times
    10  *     Test D - Free data
     7 *
     8 *   Test A - Add two times
     9 *   Test B - Add two times with overflow in microseconds
     10 *   Test C - Subtact two times
     11 *   Test D - Subtact two times with underflow in microseconds
     12 *   Test E - Delta two times
     13 *   Test F - Delta two times with underflow in microseconds
     14 *   Test G - Add two times across leapsecond boundary
     15 *   Test H - Find number of leapseconds added between two times
     16 *   Test G - Free data
    1117 *
    1218 *  @author  Ross Harman, MHPCC
    1319 *
    14  *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2004-12-16 18:53:28 $
     20 *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
     21 *  @date  $Date: 2004-12-17 20:48:47 $
    1622 *
    1723 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    138144
    139145
     146    // Test H - Find number of leapseconds added between two times
     147    printPositiveTestHeader(stdout, "psTime", "Test H - Find number of leapseconds added between two times");
     148    psS64 out = 0.0;
     149    psTime *time8a = NULL;
     150    psTime *time8b = NULL;
     151    time8a = psTimeFromISOTime("2004-12-18T1:00:00.00");
     152    time8b = psTimeFromISOTime("1972-1-1T1:00:00.00");
     153    out = psTimeLeapseconds(time8a, time8b);
     154    printf("%lld\n", out);
     155    printFooter(stdout, "psTime", "Test H - Find number of leapseconds added between two times", true);
     156
     157
    140158    // Test G - Free data
    141     printPositiveTestHeader(stdout, "psTime", "Test G - Free data");
     159    printPositiveTestHeader(stdout, "psTime", "Test I - Free data");
    142160    psLibFinalize();
    143161    psFree(time1a);
     
    156174    psFree(time7a);
    157175    psFree(timeOut7);
     176    psFree(time8a);
     177    psFree(time8b);
    158178    if (psMemCheckLeaks(0, NULL, stdout,false)) {
    159179        psError(PS_ERR_UNKNOWN,true,"Memory leaks detected.");
     
    165185        printf("ERROR: Found %d bad memory blocks\n", nBad);
    166186    }
    167     printFooter(stdout, "psTime", "Test G - Free data", true);
     187    printFooter(stdout, "psTime", "Test I - Free data", true);
    168188    return 0;
    169189}
Note: See TracChangeset for help on using the changeset viewer.