Changeset 1534
- Timestamp:
- Aug 13, 2004, 2:30:36 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/doc/pslib/psLibSDRS.tex (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/psLibSDRS.tex
r1527 r1534 1 %%% $Id: psLibSDRS.tex,v 1.6 7 2004-08-13 20:50:59 priceExp $1 %%% $Id: psLibSDRS.tex,v 1.68 2004-08-14 00:30:36 jhoblitt Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 3017 3017 \subsection{Dates and times} 3018 3018 3019 We require a collection of functions to manipulate time data. These 3020 operations primarily consist of conversions between specific time 3021 formats. PSLib currently uses the UNIX \code{timeval} structure 3022 representation of time as the native time format. 3023 \begin{verbatim} 3019 We require a collection of functions to manipulate time data. These operations 3020 primarily consist of conversions between specific time formats. Internally, 3021 PSLib handles times as struct similar to the POSIX \code{struct timeval} which 3022 has been extended to track the time system being represented. 3023 3024 \begin{verbatim} 3025 typedef enum { 3026 PS_TIME_TAI, /* seconds since 1970-01-01T00:00:00Z (Gregorian) */ 3027 PS_TIME_UTC, /* seconds since 1970-01-01T00:00:00Z (Gregorian) */ 3028 PS_TIME_UT1, /* seconds since 1970-01-01T00:00:00Z (Gregorian) */ 3029 PS_TIME_LST, /* seconds since 1970-01-01T00:00:00Z (Gregorian) */ 3030 } psTimeType; 3031 3024 3032 typedef struct { 3025 time_t tv_sec; /* seconds */ 3026 suseconds_t tv_usec; /* microseconds */ 3033 psU64 sec; /* seconds */ 3034 psU32 nsec; /* nanoseconds */ 3035 psTimeType type; /* type of time */ 3027 3036 } psTime; 3028 3037 \end{verbatim} 3029 3038 3039 A number of functions are provided to get the current time in a particular time 3040 system. 3041 3042 \begin{verbatim} 3043 psTime *psGetTAI(void); 3044 psTime *psGetUTC(void); 3045 psTime *psGetUT1(void); 3046 psTime *psGetLST(psF64 longitude); 3047 psF64 *psGetJD(void); 3048 psF64 *psGetMJD(void); 3049 \end{verbatim} 3050 3051 When converting to a time system the source time system is automaticaly 3052 converted to TAI and then from TAI to the destination type. 3053 3054 \begin{verbatim} 3055 bool psTimeToTAI(psTimeType type, psTime *time); 3056 bool psTimeToUTC(psTimeType type, psTime *time); 3057 bool psTimeToUT1(psTimeType type, psTime *time); 3058 bool psTimeToLST(psTimeType type, psTime *time); 3059 psF64 psTimeToJD(psTime *time); 3060 psF64 psTimeToMJD(psTime *time); 3061 \end{verbatim} 3062 3063 A collection of functions convert from the \code{psTime} types to various 3064 external formats. Note that ISO8601 format is "YYYY-MM-DDThh:mm:ss,sZ" 3065 3066 \begin{verbatim} 3067 char *psFormatISO8601(psTime *time); 3068 struct timeval *psFormatTimeval(psTime *time); 3069 \end{verbatim} 3070 3071 A related collection of functions convert from external formats to a 3072 \code{psTime} type. 3073 3074 \begin{verbatim} 3075 psTime *psParseISO8601(psTimeType type, char *input); 3076 psTime *psParseTimeval(psTimeType type, struct timeval *input); 3077 \end{verbatim} 3078 3079 All \code{psTime} types must be able to be converted to to the TAI type. 3080 Conversion from one \code{psTime} type to another is achieved by first 3081 converting to TAI and then to the target type. 3082 3083 \begin{verbatim} 3084 psTime *psTAIToUTC(psTime *time); 3085 psTime *psUTCToTAI(psTime *time); 3086 \end{verbatim} 3087 3030 3088 A utility function provides the current time from the system clock, in correct TAI units: 3031 3089 \begin{verbatim} 3032 psTime psTimeGetTime (void); 3033 \end{verbatim} 3034 3035 A collection of functions convert from the native \code{psTime} format 3036 to various external formats. Note that ISO Time is represented by 3037 YYYY/MM/DD,HH:MM:SS.SSS. 3038 \begin{verbatim} 3039 char *psTimeToISOTime (psTime time); 3040 double psTimeToUTC (psTime time); 3041 double psTimeToMJD (psTime time); 3042 double psTimeToJD (psTime time); 3043 struct timeval *psTimeToTimeval (psTime time); 3044 struct tm *psTimeToTm (psTime time); 3045 \end{verbatim} 3046 3047 A matching set of functions convert from the external formats to the 3048 native \code{psTime}: 3049 \begin{verbatim} 3050 psTime *psISOTimeToTime (char *input); 3051 psTime *psUTCToTime (double input); 3052 psTime *psMJDToTime (double input); 3053 psTime *psJDToTime (double input); 3054 psTime *psTimevalToTime (struct timeval *input); 3055 psTime *psTMtoTime (struct tm *input); 3090 psTime *psTAIToUT1(psTime *time); 3091 psTime *psUT1ToTAI(psTime *time); 3092 \end{verbatim} 3093 3094 \begin{verbatim} 3095 psTime *psTAIToLST(psTime *time, double longitude); 3096 psTime *psLSTToTAI(psTime *time, double longitude); 3097 \end{verbatim} 3098 3099 A number of utility functions is needed for type conversion. 3100 3101 \begin{verbatim} 3102 psTime *psUT1ToGMST00(psTime *time); 3103 psTime *psGMST00ToUT1(psTime *time); 3104 \end{verbatim} 3105 3106 \begin{verbatim} 3107 psTime *psGMST00ToLST(psTime *time, double longitude); 3108 psTime *psLSTToGMST00(psTime *time, double longitude); 3109 \end{verbatim} 3110 3111 Conversions to/from Julian Centuries. 3112 3113 \begin{verbatim} 3114 psF64 psJDToJC(psF64 time); 3115 psF64 psJCToJD(psF64 time); 3116 \end{verbatim} 3117 3118 \begin{verbatim} 3119 psF64 psMJDToJC(psF64 time); 3120 psF64 psJCToMJD(psF64 time); 3121 \end{verbatim} 3122 3123 \begin{verbatim} 3124 unsigned int psGetLeapSeconds(psTime *utc); 3125 \end{verbatim} 3126 3127 \begin{verbatim} 3128 double psGetUT1Delta(psTime *tai); 3129 \end{verbatim} 3130 3131 Time math is only done on the \code{psTime} TAI type. 3132 3133 \begin{verbatim} 3134 psTime *psTAIAdd(psTime *tai1, psTime *tai2); 3135 psTime *psTAISub(psTime *tai1, psTime *tai2); 3136 psTime *psTAIDelta(psTime *tai1, psTime *tai2); 3056 3137 \end{verbatim} 3057 3138
Note:
See TracChangeset
for help on using the changeset viewer.
