IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 16, 2004, 8:53:35 AM (22 years ago)
Author:
harman
Message:

Added new time math functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astronomy/psTime.h

    r2318 r2725  
    55 *
    66 *  A collection of functions are required by psLib to manipulate time data. These functions primarily consist
    7  *  of conversions between specific time formats.  PSLib currently uses the UNIX timeval time system as the
    8  *  base upon which International Atomic Time (TAI) and Universal Time Coordinated (UTC) are calculated. TAI
    9  *  time varies over time due to the earth's rotation and the movement of the continental plates. It is
    10  *  currentls 32 seconds faster than UTC/timeval time. The conversion between TAI and UTC time for other dates
    11  *  is given in the table below, which comes from:
    12  *
    13  *  ftp://maia.usno.navy.mil/ser7/tai-utc.dat
    14  *
    15  *  This table is placed into a static array and used by the psTime functions for conversions.
    16  *
    17  *   1961 JAN  1 =JD 2437300.5  TAI-UTC=   1.4228180 S + (MJD - 37300.) X 0.001296 S
    18  *   1961 AUG  1 =JD 2437512.5  TAI-UTC=   1.3728180 S + (MJD - 37300.) X 0.001296 S
    19  *   1962 JAN  1 =JD 2437665.5  TAI-UTC=   1.8458580 S + (MJD - 37665.) X 0.0011232S
    20  *   1963 NOV  1 =JD 2438334.5  TAI-UTC=   1.9458580 S + (MJD - 37665.) X 0.0011232S
    21  *   1964 JAN  1 =JD 2438395.5  TAI-UTC=   3.2401300 S + (MJD - 38761.) X 0.001296 S
    22  *   1964 APR  1 =JD 2438486.5  TAI-UTC=   3.3401300 S + (MJD - 38761.) X 0.001296 S
    23  *   1964 SEP  1 =JD 2438639.5  TAI-UTC=   3.4401300 S + (MJD - 38761.) X 0.001296 S
    24  *   1965 JAN  1 =JD 2438761.5  TAI-UTC=   3.5401300 S + (MJD - 38761.) X 0.001296 S
    25  *   1965 MAR  1 =JD 2438820.5  TAI-UTC=   3.6401300 S + (MJD - 38761.) X 0.001296 S
    26  *   1965 JUL  1 =JD 2438942.5  TAI-UTC=   3.7401300 S + (MJD - 38761.) X 0.001296 S
    27  *   1965 SEP  1 =JD 2439004.5  TAI-UTC=   3.8401300 S + (MJD - 38761.) X 0.001296 S
    28  *   1966 JAN  1 =JD 2439126.5  TAI-UTC=   4.3131700 S + (MJD - 39126.) X 0.002592 S
    29  *   1968 FEB  1 =JD 2439887.5  TAI-UTC=   4.2131700 S + (MJD - 39126.) X 0.002592 S
    30  *   1972 JAN  1 =JD 2441317.5  TAI-UTC=  10.0       S + (MJD - 41317.) X 0.0      S
    31  *   1972 JUL  1 =JD 2441499.5  TAI-UTC=  11.0       S + (MJD - 41317.) X 0.0      S
    32  *   1973 JAN  1 =JD 2441683.5  TAI-UTC=  12.0       S + (MJD - 41317.) X 0.0      S
    33  *   1974 JAN  1 =JD 2442048.5  TAI-UTC=  13.0       S + (MJD - 41317.) X 0.0      S
    34  *   1975 JAN  1 =JD 2442413.5  TAI-UTC=  14.0       S + (MJD - 41317.) X 0.0      S
    35  *   1976 JAN  1 =JD 2442778.5  TAI-UTC=  15.0       S + (MJD - 41317.) X 0.0      S
    36  *   1977 JAN  1 =JD 2443144.5  TAI-UTC=  16.0       S + (MJD - 41317.) X 0.0      S
    37  *   1978 JAN  1 =JD 2443509.5  TAI-UTC=  17.0       S + (MJD - 41317.) X 0.0      S
    38  *   1979 JAN  1 =JD 2443874.5  TAI-UTC=  18.0       S + (MJD - 41317.) X 0.0      S
    39  *   1980 JAN  1 =JD 2444239.5  TAI-UTC=  19.0       S + (MJD - 41317.) X 0.0      S
    40  *   1981 JUL  1 =JD 2444786.5  TAI-UTC=  20.0       S + (MJD - 41317.) X 0.0      S
    41  *   1982 JUL  1 =JD 2445151.5  TAI-UTC=  21.0       S + (MJD - 41317.) X 0.0      S
    42  *   1983 JUL  1 =JD 2445516.5  TAI-UTC=  22.0       S + (MJD - 41317.) X 0.0      S
    43  *   1985 JUL  1 =JD 2446247.5  TAI-UTC=  23.0       S + (MJD - 41317.) X 0.0      S
    44  *   1988 JAN  1 =JD 2447161.5  TAI-UTC=  24.0       S + (MJD - 41317.) X 0.0      S
    45  *   1990 JAN  1 =JD 2447892.5  TAI-UTC=  25.0       S + (MJD - 41317.) X 0.0      S
    46  *   1991 JAN  1 =JD 2448257.5  TAI-UTC=  26.0       S + (MJD - 41317.) X 0.0      S
    47  *   1992 JUL  1 =JD 2448804.5  TAI-UTC=  27.0       S + (MJD - 41317.) X 0.0      S
    48  *   1993 JUL  1 =JD 2449169.5  TAI-UTC=  28.0       S + (MJD - 41317.) X 0.0      S
    49  *   1994 JUL  1 =JD 2449534.5  TAI-UTC=  29.0       S + (MJD - 41317.) X 0.0      S
    50  *   1996 JAN  1 =JD 2450083.5  TAI-UTC=  30.0       S + (MJD - 41317.) X 0.0      S
    51  *   1997 JUL  1 =JD 2450630.5  TAI-UTC=  31.0       S + (MJD - 41317.) X 0.0      S
    52  *   1999 JAN  1 =JD 2451179.5  TAI-UTC=  32.0       S + (MJD - 41317.) X 0.0      S
     7 *  of conversions between specific time formats.  They use the UNIX timeval time system as the
     8 *  base upon which International Atomic Time (TAI) and Universal Time Coordinated (UTC) are calculated.
    539 *
    5410 *  @author Ross Harman, MHPCC
    5511 *
    56  *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    57  *  @date $Date: 2004-11-10 18:27:08 $
     12 *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-12-16 18:52:51 $
    5814 *
    5915 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    6016 */
     17
    6118
    6219#ifndef PSTIME_H
     
    10764 * @return  bool: True for success, false for failure.
    10865 */
    109 psBool psTimeInit(const char *fileName);
     66psBool p_psTimeInit(const char *fileName);
    11067
    11168/** Free memory persistant time data.
     
    11572 * @return  void: void.
    11673 */
    117 psBool psTimeFinalize(void);
     74psBool p_psTimeFinalize(void);
    11875
    11976/** Allocate time struct.
     
    305262);
    306263
    307 /** Add two TAI times.
    308  *
    309  *  Adds two TAI times. This function does not add or subtract leapseconds.
     264/** Adds delta to time. Result is in TAI time.
     265 *
     266 *  Adds delta to time. Input time is converted to TAI format if necessary.
    310267 *
    311268 *  @return  psTime*: time.
    312269 */
    313 psTime* psTimeAdd(
    314     const psTime *tai1,                 ///< First TAI time.
    315     const psTime *tai2                  ///< Second TAI time.
    316 );
    317 
    318 /** Subtract two TAI times.
    319  *
    320  *  Subtracts two TAI times. This function does not add or subtract leapseconds.
    321  *
    322  *  @return  psTime*: time.
    323  */
    324 psTime* psTimeSubtract(
    325     const psTime *tai1,                 ///< First TAI time.
    326     const psTime *tai2                  ///< Second TAI time.
    327 );
    328 
    329 
    330 /** Find delta of two TAI times.
    331  *
    332  *  Finds the absolute difference of two TAI times. This function does not add or subtract leapseconds.
    333  *
    334  *  @return  psTime*: time.
    335  */
    336 psTime* psTimeDelta(
    337     const psTime *tai1,                 ///< First TAI time.
    338     const psTime *tai2                  ///< Second TAI time.
     270psTime* psTimeMath(
     271    const psTime *time,                 ///< Time.
     272    psF64 delta                         ///< Time delta.
     273);
     274
     275/** Determine difference between two times. Result is in TAI time.
     276 *
     277 *  Determine difference between two times. Input times are converted to TAI format if necessary.
     278 *
     279 *  @return psF64: Time difference.
     280 */
     281psF64 psTimeDelta(
     282    const psTime *time1,                ///< First time.
     283    const psTime *time2                 ///< Second time.
    339284);
    340285
Note: See TracChangeset for help on using the changeset viewer.