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
12
typedef struct MJDtimeStruct
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.
19
int base_day; // integer part of MJD used as default
20
double time_sec; // seconds from start of base_day
23
struct QSASConfigStruct
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
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
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.
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.
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
56
// We reserve other bits of ccontrol for future use.
58
// index keeps track of latest bhunt_search index.
62
// Set if the qsastime library is being tested.
63
#cmakedefine TEST_QSASTIME
66
#define QSASTIME_static
68
#define QSASTIME_static static
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 );
76
QSASTIME_static void normalize_MJD( MJDtime *MJD );
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 );
82
QSASTIME_static int dsplint( double *xa, double *ya, double *y2a, int n, double x, double *y );