IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1223


Ignore:
Timestamp:
Jul 15, 2004, 9:02:13 AM (22 years ago)
Author:
harman
Message:

Initial version

Location:
trunk/psLib
Files:
7 added
3 edited

Legend:

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

    r1211 r1223  
    11/** @file  psTime.h
    22 *
    3  *  @brief Provides time and timing utilities for psLib.
     3 *  @brief Definitions for time, time utilities, and conversion functions for use with psLib astronomy
     4 *  functions.
    45 *
    5  *  Time, time utilities, and conversion functions are defined for use with psLib astronomy functions.
    6  *
    7  *  @ingroup Time
     6 *  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) time is calculated. All time conversion functions within
     9 *  psLib, except those noted, are calculated in terms of TAI time, which is approxinmately 32 seconds faster
     10 *  than UTC/timeval.
    811 *
    912 *  @author Ross Harman, MHPCC
    1013 *
    11  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-07-13 01:04:37 $
     14 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-07-15 19:02:13 $
    1316 *
    1417 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1720#ifndef PSTIME_H
    1821#define PSTIME_H
     22
     23#include <time.h>
     24#include <sys/types.h>
     25#include <sys/time.h>
     26
     27#include "psType.h"
    1928
    2029/// @addtogroup Time
     
    2534/******************************************************************************/
    2635
    27 /** Struct containing psTime.
     36/** Definition of psTime.
    2837 *
    29  *  This struct defines current time in terms of seconds, nanoseconds, and attoseconds.
     38 *  The psTime struct is used by psLib to represent time values critical to astronomical calculations.  This
     39 *  structure represents a time which is equivalent to TAI (International Atomic Time) and is measured in
     40 *  both seconds and microseconds.
    3041 */
    3142typedef struct
    3243{
    33     long tv_sec;    /**< Seconds since epoch, Jan 1, 1970. */
    34     long tv_nsec;   /**< Nanoseconds since last second. */
    35     long tv_asec;   /**< Attoseconds since last nanosecond. */
     44    time_t        tv_sec;    /**< Seconds since epoch, Jan 1, 1970. */
     45    suseconds_t   tv_usec;   /**< Microseconds since last second. */
    3646}
    3747psTime;
     
    4151/*****************************************************************************/
    4252
    43 /** Get current UTC time.
     53/** Get current TAI time.
    4454 *
    45  * Gets current UTC timespec time.
     55 * Gets current time from the system clock in correct TAI units.
    4656 *
    47  *  @return  psTime*: Pointer to struct with current time.
     57 *  @return  psTime: Struct with current time.
    4858 */
    49 psTime* psGetTime(
    50     psTime *time    /** Time to return or null for auto allocation. */
     59psTime psTimeGetTime(
     60    void   /** No argument. */
    5161);
    5262
    53 /** Convert psTime to ISO time.
     63/** Convert psTime to ISO time in TAI units.
    5464 *
    55  * Converts psTime to a null terminated string in the form of: YYYY/MM/DD,HH:MM:SS.SSS.
     65 * Converts psTime to a null terminated string in the form of: YYYY/MM/DD,HH:MM:SS.SSS. The result from this
     66 * function is in TAI units.
    5667 *
    57  *  @return  char*: Pointer null terminated array of chars.
     68 *  @return  char*: Pointer null terminated array of chars in ISO/TAI time.
    5869 */
    59 char* psTimeToISOTime(
    60     psTime *time    /** Input time to be converted. */
     70char* psTimeToISO(
     71    psTime time     /** Input time to be converted. */
    6172);
    6273
    6374/** Convert psTime to UTC time.
    6475 *
    65  * Converts psTime to UTC time in double precision floating point notation.
     76 * Converts psTime to UTC time in double precision floating point notation. The result from this function is
     77 * not in TAI units, but that of UTC, which does not contain leapseconds.
    6678 *
    6779 *  @return  double: UTC time in floating point notation.
    6880 */
    69 double psTimeToISOTime(
    70     psTime *time    /** Input time to be converted. */
     81double psTimeToUTC(
     82    psTime time    /** Input time to be converted. */
    7183);
    7284
     85/** Convert psTime to modified Julian date time.
     86 *
     87 * Converts psTime to modified Julian date (MJD) time. The result from this function is in TAI units.
     88 *
     89 *  @return  double: MJD/TAI time in floating point notation.
     90 */
     91double psTimeToMJD(
     92    psTime time    /** Input time to be converted. */
     93);
     94
     95/** Convert psTime to Julian date time.
     96 *
     97 * Converts psTime to Julian date (JD) time. The result from this function is in TAI units.
     98 *
     99 *  @return  double: JD/TAI time in floating point notation.
     100 */
     101double psTimeToJD(
     102    psTime time    /** Input time to be converted. */
     103);
     104
     105/** Convert psTime to timeval time.
     106 *
     107 * Converts psTime to timeval time. The result from this function is in TAI units.
     108 *
     109 *  @return  timeval: timeval/TAI time.
     110 */
     111struct timeval psTimeToTimeval(
     112                psTime time    /** Input time to be converted. */
     113            );
     114
     115/** Convert psTime to tm time.
     116 *
     117 * Converts psTime to tm time. The result from this function is in TAI units.
     118 *
     119 *  @return  tm: tm/TAI time.
     120 */
     121struct tm* psTimeToTM(
     122                psTime time    /** Input time to be converted. */
     123            );
     124
     125/** Convert ISO to psTime.
     126 *
     127 * Converts ISO time to psTime. The result from this function is in TAI units.
     128 *
     129 *  @return  psTime: time in TAI units.
     130 */
     131psTime psISOToTime(char *time);
     132
     133/** Convert UTC to psTime.
     134 *
     135 * Converts UTC time to psTime. The result from this function is in TAI units.
     136 *
     137 *  @return  psTime: time in TAI units.
     138 */
     139psTime psUTCToTime(double time);
     140
     141/** Convert MJD to psTime.
     142 *
     143 * Converts MJD time to psTime. The result from this function is in TAI units.
     144 *
     145 *  @return  psTime: time in TAI units.
     146 */
     147psTime psMJDToTime(double time);
     148
     149/** Convert JD to psTime.
     150 *
     151 * Converts JD time to psTime. The result from this function is in TAI units.
     152 *
     153 *  @return  psTime: time in TAI units.
     154 */
     155psTime psJDToTime(double time);
     156
     157/** Convert timeval to psTime.
     158 *
     159 * Converts timeval time to psTime. The result from this function is in TAI units.
     160 *
     161 *  @return  psTime: time in TAI units.
     162 */
     163psTime psTimevalToTime(struct timeval *time);
     164
     165/** Convert tm time to psTime.
     166 *
     167 * Converts tm time to psTime. The result from this function is in TAI units.
     168 *
     169 *  @return  psTime: time in TAI units.
     170 */
     171psTime psTMToTime(struct tm *time);
    73172/// @}
    74173
  • trunk/psLib/src/astronomy/Makefile

    r1209 r1223  
    77CFLAGS := $(CFLAGS_RELOC) -I. -I../sysUtils -I../collections -I..
    88
    9 SRC_OBJS =
     9SRC_OBJS = psTime.o
    1010
    1111all: $(TARGET_STATIC)
  • trunk/psLib/src/astronomy/psTime.h

    r1211 r1223  
    11/** @file  psTime.h
    22 *
    3  *  @brief Provides time and timing utilities for psLib.
     3 *  @brief Definitions for time, time utilities, and conversion functions for use with psLib astronomy
     4 *  functions.
    45 *
    5  *  Time, time utilities, and conversion functions are defined for use with psLib astronomy functions.
    6  *
    7  *  @ingroup Time
     6 *  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) time is calculated. All time conversion functions within
     9 *  psLib, except those noted, are calculated in terms of TAI time, which is approxinmately 32 seconds faster
     10 *  than UTC/timeval.
    811 *
    912 *  @author Ross Harman, MHPCC
    1013 *
    11  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-07-13 01:04:37 $
     14 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-07-15 19:02:13 $
    1316 *
    1417 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1720#ifndef PSTIME_H
    1821#define PSTIME_H
     22
     23#include <time.h>
     24#include <sys/types.h>
     25#include <sys/time.h>
     26
     27#include "psType.h"
    1928
    2029/// @addtogroup Time
     
    2534/******************************************************************************/
    2635
    27 /** Struct containing psTime.
     36/** Definition of psTime.
    2837 *
    29  *  This struct defines current time in terms of seconds, nanoseconds, and attoseconds.
     38 *  The psTime struct is used by psLib to represent time values critical to astronomical calculations.  This
     39 *  structure represents a time which is equivalent to TAI (International Atomic Time) and is measured in
     40 *  both seconds and microseconds.
    3041 */
    3142typedef struct
    3243{
    33     long tv_sec;    /**< Seconds since epoch, Jan 1, 1970. */
    34     long tv_nsec;   /**< Nanoseconds since last second. */
    35     long tv_asec;   /**< Attoseconds since last nanosecond. */
     44    time_t        tv_sec;    /**< Seconds since epoch, Jan 1, 1970. */
     45    suseconds_t   tv_usec;   /**< Microseconds since last second. */
    3646}
    3747psTime;
     
    4151/*****************************************************************************/
    4252
    43 /** Get current UTC time.
     53/** Get current TAI time.
    4454 *
    45  * Gets current UTC timespec time.
     55 * Gets current time from the system clock in correct TAI units.
    4656 *
    47  *  @return  psTime*: Pointer to struct with current time.
     57 *  @return  psTime: Struct with current time.
    4858 */
    49 psTime* psGetTime(
    50     psTime *time    /** Time to return or null for auto allocation. */
     59psTime psTimeGetTime(
     60    void   /** No argument. */
    5161);
    5262
    53 /** Convert psTime to ISO time.
     63/** Convert psTime to ISO time in TAI units.
    5464 *
    55  * Converts psTime to a null terminated string in the form of: YYYY/MM/DD,HH:MM:SS.SSS.
     65 * Converts psTime to a null terminated string in the form of: YYYY/MM/DD,HH:MM:SS.SSS. The result from this
     66 * function is in TAI units.
    5667 *
    57  *  @return  char*: Pointer null terminated array of chars.
     68 *  @return  char*: Pointer null terminated array of chars in ISO/TAI time.
    5869 */
    59 char* psTimeToISOTime(
    60     psTime *time    /** Input time to be converted. */
     70char* psTimeToISO(
     71    psTime time     /** Input time to be converted. */
    6172);
    6273
    6374/** Convert psTime to UTC time.
    6475 *
    65  * Converts psTime to UTC time in double precision floating point notation.
     76 * Converts psTime to UTC time in double precision floating point notation. The result from this function is
     77 * not in TAI units, but that of UTC, which does not contain leapseconds.
    6678 *
    6779 *  @return  double: UTC time in floating point notation.
    6880 */
    69 double psTimeToISOTime(
    70     psTime *time    /** Input time to be converted. */
     81double psTimeToUTC(
     82    psTime time    /** Input time to be converted. */
    7183);
    7284
     85/** Convert psTime to modified Julian date time.
     86 *
     87 * Converts psTime to modified Julian date (MJD) time. The result from this function is in TAI units.
     88 *
     89 *  @return  double: MJD/TAI time in floating point notation.
     90 */
     91double psTimeToMJD(
     92    psTime time    /** Input time to be converted. */
     93);
     94
     95/** Convert psTime to Julian date time.
     96 *
     97 * Converts psTime to Julian date (JD) time. The result from this function is in TAI units.
     98 *
     99 *  @return  double: JD/TAI time in floating point notation.
     100 */
     101double psTimeToJD(
     102    psTime time    /** Input time to be converted. */
     103);
     104
     105/** Convert psTime to timeval time.
     106 *
     107 * Converts psTime to timeval time. The result from this function is in TAI units.
     108 *
     109 *  @return  timeval: timeval/TAI time.
     110 */
     111struct timeval psTimeToTimeval(
     112                psTime time    /** Input time to be converted. */
     113            );
     114
     115/** Convert psTime to tm time.
     116 *
     117 * Converts psTime to tm time. The result from this function is in TAI units.
     118 *
     119 *  @return  tm: tm/TAI time.
     120 */
     121struct tm* psTimeToTM(
     122                psTime time    /** Input time to be converted. */
     123            );
     124
     125/** Convert ISO to psTime.
     126 *
     127 * Converts ISO time to psTime. The result from this function is in TAI units.
     128 *
     129 *  @return  psTime: time in TAI units.
     130 */
     131psTime psISOToTime(char *time);
     132
     133/** Convert UTC to psTime.
     134 *
     135 * Converts UTC time to psTime. The result from this function is in TAI units.
     136 *
     137 *  @return  psTime: time in TAI units.
     138 */
     139psTime psUTCToTime(double time);
     140
     141/** Convert MJD to psTime.
     142 *
     143 * Converts MJD time to psTime. The result from this function is in TAI units.
     144 *
     145 *  @return  psTime: time in TAI units.
     146 */
     147psTime psMJDToTime(double time);
     148
     149/** Convert JD to psTime.
     150 *
     151 * Converts JD time to psTime. The result from this function is in TAI units.
     152 *
     153 *  @return  psTime: time in TAI units.
     154 */
     155psTime psJDToTime(double time);
     156
     157/** Convert timeval to psTime.
     158 *
     159 * Converts timeval time to psTime. The result from this function is in TAI units.
     160 *
     161 *  @return  psTime: time in TAI units.
     162 */
     163psTime psTimevalToTime(struct timeval *time);
     164
     165/** Convert tm time to psTime.
     166 *
     167 * Converts tm time to psTime. The result from this function is in TAI units.
     168 *
     169 *  @return  psTime: time in TAI units.
     170 */
     171psTime psTMToTime(struct tm *time);
    73172/// @}
    74173
Note: See TracChangeset for help on using the changeset viewer.