PLplot
5.10.0
|
00001 #ifndef _QSASTIMEP_H_ 00002 #define _QSASTIMEP_H_ 00003 00004 // Declaration of private structures within libqsastime which the user does 00005 // not need to acccess. 00006 // Also definition of functions within libqsastime that are needed 00007 // for testing of libqsastime, but which are not normally needed for anything 00008 // else 00009 00010 #include "qsastime.h" 00011 00012 typedef struct MJDtimeStruct 00013 { 00014 // 00015 // MJD starts at 0h, so truncating MJD always gives the same day whatever the time (unlike JD). 00016 // The MJD base day is arbitrary, i.e. seconds can be greater than one day or even negative. 00017 // 00018 00019 int base_day; // integer part of MJD used as default 00020 double time_sec; // seconds from start of base_day 00021 }MJDtime; 00022 00023 struct QSASConfigStruct 00024 { 00025 // Values used to define the transformation between broken down time 00026 // and continuous time for the public API of libqsastime, 00027 // continuous_time_qsas, broken_down_time_qsas, and strfqsas. 00028 00029 // scale multiplies the continuous time variable to convert the units to 00030 // days. 00031 double scale; 00032 00033 // offset1 and offset2 (in days) specifies the amount to add to the 00034 // scaled continuous time to derive the MJD time value that is used 00035 // internally by libqsastime. Normally epoch1 is an integral 00036 // value (which can be exactly stored in a double for a very wide 00037 // range of integers) and offset2 is normally a non-integral value 00038 // whose absolute value is less than 1. This arrangement allows the 00039 // continuous time variable in the API to be stored as a single double 00040 // without compromising numerical precision if epoch1 and epoch2 00041 // are chosen wisely. 00042 double offset1, offset2; 00043 00044 // The various bits of ccontrol are used as independent switches to 00045 // control optional additional corrections which define the 00046 // transformation between continuous time and broken-down time. 00047 // 00048 // If bit 0 (the lowest order bit of ccontrol) is 1 the Julian 00049 // proleptic calendar is used for broken-down time. Otherwise the 00050 // Gregorian proleptic calendar is used for broken-down time. 00051 // 00052 // If bit 1 is 1, an additional correction for the difference 00053 // between atomic-clock based times and UTC is applied to the broken-down 00054 // times. 00055 // 00056 // We reserve other bits of ccontrol for future use. 00057 int ccontrol; 00058 // index keeps track of latest bhunt_search index. 00059 int index; 00060 }; 00061 00062 // Set if the qsastime library is being tested. 00063 /* #undef TEST_QSASTIME */ 00064 00065 #ifdef TEST_QSASTIME 00066 #define QSASTIME_static 00067 #else 00068 #define QSASTIME_static static 00069 #endif 00070 00071 QSASTIME_static void bhunt_search( const void *key, const void *base, int n, size_t size, int *low, int ( *ge )( const void *keyval, const void *datum ) ); 00072 00073 QSASTIME_static int setFromUT( int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int forceJulian ); 00074 QSASTIME_static void breakDownMJD( int *year, int *month, int *day, int *hour, int *min, double *sec, const MJDtime *MJD, int forceJulian ); 00075 QSASTIME_static size_t strfMJD( char * buf, size_t len, const char *format, const MJDtime *MJD, int forceJulian, int if60secformat ); 00076 QSASTIME_static void normalize_MJD( MJDtime *MJD ); 00077 QSASTIME_static const char * getDayOfWeek( const MJDtime *MJD ); 00078 QSASTIME_static const char * getLongDayOfWeek( const MJDtime *MJD ); 00079 QSASTIME_static const char * getMonth( int m ); 00080 QSASTIME_static const char * getLongMonth( int m ); 00081 QSASTIME_static void getYAD( int *year, int *ifleapyear, int *doy, const MJDtime *MJD, int forceJulian ); 00082 00083 #endif