00001 /* 00002 * timeio.h ~CM)/include 00003 * 00004 * Defines and declarations for date/time parsers sscan_time(), sprint_time(), 00005 * and related functions in SOI CM libast. 00006 * Additional information is in the following man pages: 00007 * sscan_time (3), sprint_time (3) 00008 * 00009 * Responsible: Rick Bogart RBogart@spd.aas.org 00010 * 00011 * Bugs: 00012 * The function utc_adjustment is undocumented, and should probably not be 00013 * exposed as an extern, or possibly eliminated entirely 00014 * The TIME typedef declaration conflicts with the same typedef in the old 00015 * wso /usr/local functions, and the meaning is different; concurrent use 00016 * of both libraries should be avoided 00017 * 00018 * Revision history is at the end of the file. 00019 */ 00020 #ifndef TIMECNVRT_INCL 00021 /****************************************************************************/ 00022 /************************** INCLUDE STATEMENTS ****************************/ 00023 /****************************************************************************/ 00024 00025 #include <sys/types.h> 00026 #include <time.h> 00027 00028 /****************************************************************************/ 00029 /**************************** DEFINE STATEMENTS ***************************/ 00030 /****************************************************************************/ 00031 00032 #define TIMECNVRT_INCL 1 00033 00034 /****************************************************************************/ 00035 /******************************* TYPEDEFS *********************************/ 00036 /****************************************************************************/ 00037 00038 typedef double TIME; 00039 00040 /****************************************************************************/ 00041 /**************************** MACRO DEFINITIONS ***************************/ 00042 /****************************************************************************/ 00043 00044 #define sprint_at(A, B) (sprint_time (A, B, "TAI", 0)) 00045 #define sprint_dt(A, B) (sprint_time (A, B, "TDT", 0)) 00046 #define sprint_ut(A, B) (sprint_time (A, B, "UT", 0)) 00047 #define CURRENT_SYSTEM_TIME (time (NULL) + UNIX_EPOCH) 00048 #define JULIAN_DAY_ZERO (sscan_time ("JD_0.0")) 00049 #define SOHO_EPOCH (sscan_time ("1958.01.01_00:00:00_TAI")) 00050 #define UNIX_EPOCH (sscan_time ("1970.01.01_00:00:00_UTC")) 00051 #define SOHO_LAUNCH (sscan_time ("1995.12.02_08:08:00_UT")) 00052 #define MDI_FIRST_LIGHT (sscan_time ("1995.12.19_17:49:00_UT")) 00053 #define SOI_START_LOGS (sscan_time ("1996.01.01_00:00:00_TAI")) 00054 #define MISSION_EPOCH (sscan_time ("1993.01.01_00:00:00_TAI")) 00055 00056 /****************************************************************************/ 00057 /*************************** FUNCTION PROTOTYPES **************************/ 00058 /****************************************************************************/ 00059 00060 /* source file: timeio/timeio.c */ 00061 extern TIME sscan_time (char *s); 00062 extern void sprint_time (char *s, TIME t, char *zone, int precision); 00063 extern double tai_adjustment (TIME t, char *zone); 00064 extern double zone_adjustment (char *zone); 00065 extern int time_is_invalid (TIME t); 00066 00067 #endif 00068 /* 00069 * Revision History 00070 * V 1.0 07.05.04 Rick Bogart created this file, based on previous 00071 * file soi_time.h, renamed, with minor modifications as follows: 00072 * changed inclusion define from SOI_TIME_INCL to TIMECNVRT_INCL 00073 * remove SOI_TIME_VERSION_NUM definition 00074 * removed conditional on TIME typedef 00075 * removed extern declaration of utc_adjustment() 00076 * updated comments 00077 * 07.05.25 R Bogart added prototype for time_is_invalid 00078 */