IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 16, 2004, 3:56:41 PM (22 years ago)
Author:
eugene
Message:

cleaned up time handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/psLibSDRS.tex

    r1539 r1554  
    1 %%% $Id: psLibSDRS.tex,v 1.72 2004-08-14 00:58:46 jhoblitt Exp $
     1%%% $Id: psLibSDRS.tex,v 1.73 2004-08-17 01:56:41 eugene Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    30313031\subsubsection{Overview}
    30323032
    3033 We require a collection of functions to manipulate time data.  These operations
    3034 primarily consist of conversions between specific time formats.  Internally,
    3035 PSLib handles times as struct similar to the POSIX \code{struct timeval} which
    3036 has been extended to track the time system being represented.
    3037 
    3038 Conversion from one time system to another is achived by converting first to
    3039 TAI and then to the destination type.  This allows arbitarily many time system
    3040 to be supported by merely add functions to convert to and from TAI.
    3041 
    3042 \subsubsection{Generic Data Structures}
     3033We require a collection of functions to manipulate time data.  These
     3034operations primarily consist of conversions between specific time
     3035formats.  Internally, PSLib handles times as a structure similar to
     3036the POSIX \code{timeval} which has been extended to track the time
     3037system being represented. 
    30433038
    30443039\begin{verbatim}
     
    30463041    PS_TIME_TAI,                    ///< seconds since 1970-01-01T00:00:00Z (Gregorian)
    30473042    PS_TIME_UTC,                    ///< seconds since 1970-01-01T00:00:00Z (Gregorian)
    3048     PS_TIME_UT1,                    ///< seconds since 1970-01-01T00:00:00Z (Gregorian)
    3049     PS_TIME_LST,                    ///< seconds since 1970-01-01T00:00:00Z (Gregorian)
    30503043} psTimeType;
    30513044
    30523045typedef struct {
    30533046    psU64            sec;           ///< seconds
    3054     psU32            nsec;          ///< nanoseconds
     3047    psU32            usec;          ///< microseconds
    30553048    psTimeType       type;          ///< type of time
    30563049} psTime;
     
    30593052\subsubsection{Current Date and Time}
    30603053
    3061 A number of functions are provided to get the current time in a particular time
    3062 system.
    3063 
    3064 \begin{verbatim}
    3065 psTime *psGetTAI(void);
    3066 psTime *psGetUTC(void);
    3067 psTime *psGetUT1(void);
    3068 psTime *psGetLST(psF64 longitude);
    3069 psF64 *psGetJD(void);
    3070 psF64 *psGetMJD(void);
    3071 \end{verbatim}
    3072 
    3073 \subsubsection{Automatic Date and Time Type Conversion}
    3074 
    3075 When converting to a time system the source time system is automaticaly
    3076 converted to TAI and then from TAI to the destination type.
    3077 
    3078 \begin{verbatim}
    3079 bool psTimeToTAI(psTimeType type, psTime *time);
    3080 bool psTimeToUTC(psTimeType type, psTime *time);
    3081 bool psTimeToUT1(psTimeType type, psTime *time);
    3082 bool psTimeToLST(psTimeType type, psTime *time);
     3054Get the current time (in given system):
     3055
     3056\begin{verbatim}
     3057psTime *psTimeGetTime(psTimeType);
     3058\end{verbatim}
     3059
     3060\subsubsection{Time Conversion}
     3061
     3062Converting between the \code{psTime} time systems is done with:
     3063\begin{verbatim}
     3064psTime *psTimeConvert(psTime *time, psTimeType type);
     3065\end{verbatim}
     3066This function may be used to convert between \code{PS_TIME_TAI} and
     3067\code{PS_TIME_UTC} time representations. 
     3068
     3069To convert to or from Local Mean Sidereal Time, it is necessary to
     3070provide the local longitude as well:
     3071%
     3072\begin{verbatim}
     3073psTime *psTimeToLST(psTime *time, double longitude);
     3074psTime *psLSTToTime(psTime *time, double longitude);
     3075\end{verbatim}
     3076%
     3077The functions may accept either \code{psTimeType}.  Note that this
     3078function must supply the value UT1-UTC, which is available externally
     3079The value UT1-UTC is necessary for this an various other SLALIB
     3080functions.  The following utility function encapsulates the PSLib
     3081mechanism to extract the value of UT1-UTC:
     3082\begin{verbatim}
     3083double psGetUT1Delta(psTime *time);
     3084\end{verbatim}
     3085
     3086\subsubsection{External Date and Time Formats}
     3087
     3088A collection of functions convert from the \code{psTime} types to various
     3089external formats.  Note that ISO8601 format is "YYYY-MM-DDThh:mm:ss,sZ"
     3090
     3091\begin{verbatim}
    30833092psF64 psTimeToJD(psTime *time);
    30843093psF64 psTimeToMJD(psTime *time);
    3085 \end{verbatim}
    3086 
    3087 \subsubsection{Date and Time Formatting}
    3088 
    3089 A collection of functions convert from the \code{psTime} types to various
    3090 external formats.  Note that ISO8601 format is "YYYY-MM-DDThh:mm:ss,sZ"
    3091 
    3092 \begin{verbatim}
    3093 char *psFormatISO8601(psTime *time);
    3094 struct timeval *psFormatTimeval(psTime *time);
     3094char *psTimeToISOTime(psTime *time);
     3095struct timeval *psTimeToTimeval(psTime *time);
    30953096\end{verbatim}
    30963097
     
    31013102
    31023103\begin{verbatim}
    3103 psTime *psParseISO8601(psTimeType type, char *input);
    3104 psTime *psParseTimeval(psTimeType type, struct timeval *input);
    3105 \end{verbatim}
    3106 
    3107 \subsubsection{Date and Time System Support}
    3108 
    3109 All \code{psTime} types must be able to be converted to to the TAI type.
    3110 Conversion from one \code{psTime} type to another is achieved by first
    3111 converting to TAI and then to the target type.
    3112 
    3113 \begin{verbatim}
    3114 psTime *psTAIToUTC(psTime *time);
    3115 psTime *psUTCToTAI(psTime *time);
    3116 \end{verbatim}
    3117 
    3118 A utility function provides the current time from the system clock, in correct TAI units:
    3119 
    3120 \begin{verbatim}
    3121 psTime *psTAIToUT1(psTime *time);
    3122 psTime *psUT1ToTAI(psTime *time);
    3123 \end{verbatim}
    3124 
    3125 \begin{verbatim}
    3126 psTime *psTAIToLST(psTime *time, double longitude);
    3127 psTime *psLSTToTAI(psTime *time, double longitude);
    3128 \end{verbatim}
    3129 
    3130 \subsubsection{Utility Functions}
    3131 
    3132 A number of utility functions is needed for type conversion.
    3133 
    3134 \begin{verbatim}
    3135 psTime *psUT1ToGMST00(psTime *time);
    3136 psTime *psGMST00ToUT1(psTime *time);
    3137 \end{verbatim}
    3138 
    3139 \begin{verbatim}
    3140 psTime *psGMST00ToLST(psTime *time, double longitude);
    3141 psTime *psLSTToGMST00(psTime *time, double longitude);
    3142 \end{verbatim}
    3143 
    3144 Conversions to/from Julian Centuries.
    3145 
    3146 \begin{verbatim}
    3147 psF64 psJDToJC(psF64 time);
    3148 psF64 psJCToJD(psF64 time);
    3149 \end{verbatim}
    3150 
    3151 \begin{verbatim}
    3152 psF64 psMJDToJC(psF64 time);
    3153 psF64 psJCToMJD(psF64 time);
    3154 \end{verbatim}
    3155 
    3156 \begin{verbatim}
    3157 unsigned int psGetLeapSeconds(psTime *utc);
    3158 \end{verbatim}
    3159 
    3160 \begin{verbatim}
    3161 double psGetUT1Delta(psTime *tai);
     3104psTime *psJDToTime(psF64 input);
     3105psTime *psMJDToTime(psF64 input);
     3106psTime *psISOTimeToTime(char *input);
     3107psTime *psTimevalToTime(struct timeval *input);
    31623108\end{verbatim}
    31633109
     
    37103656    PS_PROJ_AIT,                        ///< Aitoff projection
    37113657    PS_PROJ_PAR,                        ///< Par projection
    3712     PS_PROJ_GLS,                        ///< GLS projection
    37133658    PS_PROJ_NTYPE                       ///< Number of types; must be last
    37143659} psProjectionType;
Note: See TracChangeset for help on using the changeset viewer.