PLplot  5.11.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Go to the documentation of this file.
1 #ifndef _QSASTIMEP_H_
2 #define _QSASTIMEP_H_
4 // Declaration of private structures within libqsastime which the user does
5 // not need to acccess.
6 // Also definition of functions within libqsastime that are needed
7 // for testing of libqsastime, but which are not normally needed for anything
8 // else
10 #include "qsastime.h"
12 typedef struct MJDtimeStruct
13 {
14  //
15  // MJD starts at 0h, so truncating MJD always gives the same day whatever the time (unlike JD).
16  // The MJD base day is arbitrary, i.e. seconds can be greater than one day or even negative.
17  //
19  int base_day; // integer part of MJD used as default
20  double time_sec; // seconds from start of base_day
21 }MJDtime;
24 {
25  // Values used to define the transformation between broken down time
26  // and continuous time for the public API of libqsastime,
27  // continuous_time_qsas, broken_down_time_qsas, and strfqsas.
29  // scale multiplies the continuous time variable to convert the units to
30  // days.
31  double scale;
33  // offset1 and offset2 (in days) specifies the amount to add to the
34  // scaled continuous time to derive the MJD time value that is used
35  // internally by libqsastime. Normally epoch1 is an integral
36  // value (which can be exactly stored in a double for a very wide
37  // range of integers) and offset2 is normally a non-integral value
38  // whose absolute value is less than 1. This arrangement allows the
39  // continuous time variable in the API to be stored as a single double
40  // without compromising numerical precision if epoch1 and epoch2
41  // are chosen wisely.
42  double offset1, offset2;
44  // The various bits of ccontrol are used as independent switches to
45  // control optional additional corrections which define the
46  // transformation between continuous time and broken-down time.
47  //
48  // If bit 0 (the lowest order bit of ccontrol) is 1 the Julian
49  // proleptic calendar is used for broken-down time. Otherwise the
50  // Gregorian proleptic calendar is used for broken-down time.
51  //
52  // If bit 1 is 1, an additional correction for the difference
53  // between atomic-clock based times and UTC is applied to the broken-down
54  // times.
55  //
56  // We reserve other bits of ccontrol for future use.
57  int ccontrol;
58  // index keeps track of latest bhunt_search index.
59  int index;
60 };
62 // Set if the qsastime library is being tested.
63 /* #undef TEST_QSASTIME */
66 #define QSASTIME_static
67 #else
68 #define QSASTIME_static static
69 #endif
71 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 ) );
73 QSASTIME_static int setFromUT( int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int forceJulian );
74 QSASTIME_static void breakDownMJD( int *year, int *month, int *day, int *hour, int *min, double *sec, const MJDtime *MJD, int forceJulian );
75 QSASTIME_static size_t strfMJD( char * buf, size_t len, const char *format, const MJDtime *MJD, int forceJulian, int if60secformat );
77 QSASTIME_static const char * getDayOfWeek( const MJDtime *MJD );
78 QSASTIME_static const char * getLongDayOfWeek( const MJDtime *MJD );
79 QSASTIME_static const char * getMonth( int m );
80 QSASTIME_static const char * getLongMonth( int m );
81 QSASTIME_static void getYAD( int *year, int *ifleapyear, int *doy, const MJDtime *MJD, int forceJulian );
83 #endif
QSASTIME_static const char * getMonth(int m)
Definition: qsastime.c:352
int min(int a, int b)
#define QSASTIME_static
Definition: qsastimeP.h:68
double offset1
Definition: qsastimeP.h:42
QSASTIME_static const char * getLongDayOfWeek(const MJDtime *MJD)
Definition: qsastime.c:343
QSASTIME_static void getYAD(int *year, int *ifleapyear, int *doy, const MJDtime *MJD, int forceJulian)
Definition: qsastime.c:175
double time_sec
Definition: qsastimeP.h:20
QSASTIME_static const char * getDayOfWeek(const MJDtime *MJD)
Definition: qsastime.c:334
static char buf[200]
Definition: tclAPI.c:861
QSASTIME_static void normalize_MJD(MJDtime *MJD)
Definition: qsastime.c:270
QSASTIME_static size_t strfMJD(char *buf, size_t len, const char *format, const MJDtime *MJD, int forceJulian, int if60secformat)
Definition: qsastime.c:365
double offset2
Definition: qsastimeP.h:42
QSASTIME_static int setFromUT(int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int forceJulian)
Definition: qsastime.c:71
QSASTIME_static const char * getLongMonth(int m)
Definition: qsastime.c:358
struct MJDtimeStruct MJDtime
QSASTIME_static void breakDownMJD(int *year, int *month, int *day, int *hour, int *min, double *sec, const MJDtime *MJD, int forceJulian)
Definition: qsastime.c:289
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))
Definition: qsastime.c:1312