PLplot 5.15.0
Loading...
Searching...
No Matches
qsastimeP.h
Go to the documentation of this file.
1#ifndef _QSASTIMEP_H_
2#define _QSASTIMEP_H_
3
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
9
10#include "qsastime.h"
11
12typedef 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 //
18
19 int base_day; // integer part of MJD used as default
20 double time_sec; // seconds from start of base_day
22
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.
28
29 // scale multiplies the continuous time variable to convert the units to
30 // days.
31 double scale;
32
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.
43
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.
58 // index keeps track of latest bhunt_search index.
59 int index;
60};
61
62// Set if the qsastime library is being tested.
63/* #undef TEST_QSASTIME */
64
65#ifdef TEST_QSASTIME
66#define QSASTIME_static
67#else
68#define QSASTIME_static static
69#endif
70
71QSASTIME_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 ) );
72
73QSASTIME_static int setFromUT( int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int forceJulian );
74QSASTIME_static void breakDownMJD( int *year, int *month, int *day, int *hour, int *min, double *sec, const MJDtime *MJD, int forceJulian );
75QSASTIME_static size_t strfMJD( char * buf, size_t len, const char *format, const MJDtime *MJD, int forceJulian, int if60secformat );
77QSASTIME_static const char * getDayOfWeek( const MJDtime *MJD );
78QSASTIME_static const char * getLongDayOfWeek( const MJDtime *MJD );
79QSASTIME_static const char * getMonth( int m );
80QSASTIME_static const char * getLongMonth( int m );
81QSASTIME_static void getYAD( int *year, int *ifleapyear, int *doy, const MJDtime *MJD, int forceJulian );
82
83#endif
#define min(x, y)
Definition: nnpi.c:87
QSASTIME_static const char * getLongDayOfWeek(const MJDtime *MJD)
Definition: qsastime.c:343
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
QSASTIME_static void getYAD(int *year, int *ifleapyear, int *doy, const MJDtime *MJD, int forceJulian)
Definition: qsastime.c:175
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
struct MJDtimeStruct MJDtime
QSASTIME_static const char * getMonth(int m)
Definition: qsastime.c:352
#define QSASTIME_static
Definition: qsastimeP.h:68
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
QSASTIME_static void normalize_MJD(MJDtime *MJD)
Definition: qsastime.c:270
QSASTIME_static const char * getDayOfWeek(const MJDtime *MJD)
Definition: qsastime.c:334
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 time_sec
Definition: qsastimeP.h:20
double offset2
Definition: qsastimeP.h:42
double offset1
Definition: qsastimeP.h:42
static char buf[200]
Definition: tclAPI.c:873