File: qsastimeP.h.in

package info (click to toggle)
plplot 5.14.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 30,424 kB
  • sloc: ansic: 79,613; xml: 28,583; cpp: 20,037; ada: 19,456; tcl: 12,081; f90: 11,423; ml: 7,276; java: 6,863; python: 6,792; sh: 3,185; perl: 828; lisp: 75; makefile: 48; sed: 33; fortran: 5
file content (83 lines) | stat: -rw-r--r-- 3,513 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef _QSASTIMEP_H_
#define _QSASTIMEP_H_

// Declaration of private structures within libqsastime which the user does
// not need to acccess.
// Also definition of functions within libqsastime that are needed
// for testing of libqsastime, but which are not normally needed for anything
// else

#include "qsastime.h"

typedef struct MJDtimeStruct
{
    //
    // MJD starts at 0h, so truncating MJD always gives the same day whatever the time (unlike JD).
    // The MJD base day is arbitrary, i.e. seconds can be greater than one day or even negative.
    //

    int    base_day; // integer part of MJD used as default
    double time_sec; // seconds from start of base_day
}MJDtime;

struct QSASConfigStruct
{
    // Values used to define the transformation between broken down time
    // and continuous time for the public API of libqsastime,
    // continuous_time_qsas, broken_down_time_qsas, and strfqsas.

    // scale multiplies the continuous time variable to convert the units to
    // days.
    double scale;

    // offset1 and offset2 (in days) specifies the amount to add to the
    // scaled continuous time to derive the MJD time value that is used
    // internally by libqsastime.  Normally epoch1 is an integral
    // value (which can be exactly stored in a double for a very wide
    // range of integers) and offset2 is normally a non-integral value
    // whose absolute value is less than 1.  This arrangement allows the
    // continuous time variable in the API to be stored as a single double
    // without compromising numerical precision if epoch1 and epoch2
    // are chosen wisely.
    double offset1, offset2;

    // The various bits of ccontrol are used as independent switches to
    // control optional additional corrections which define the
    // transformation between continuous time and broken-down time.
    //
    // If bit 0 (the lowest order bit of ccontrol) is 1 the Julian
    // proleptic calendar is used for broken-down time. Otherwise the
    // Gregorian proleptic calendar is used for broken-down time.
    //
    // If bit 1 is 1, an additional correction for the difference
    // between atomic-clock based times and UTC is applied to the broken-down
    // times.
    //
    // We reserve other bits of ccontrol for future use.
    int ccontrol;
    // index keeps track of latest bhunt_search index.
    int index;
};

// Set if the qsastime library is being tested.
#cmakedefine TEST_QSASTIME

#ifdef TEST_QSASTIME
#define QSASTIME_static
#else
#define QSASTIME_static    static
#endif

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 ) );

QSASTIME_static int setFromUT( int year, int month, int day, int hour, int min, double sec, MJDtime *MJD, int forceJulian );
QSASTIME_static void breakDownMJD( int *year, int *month, int *day, int *hour, int *min, double *sec, const MJDtime *MJD, int forceJulian );
QSASTIME_static size_t strfMJD( char * buf, size_t len, const char *format, const MJDtime *MJD, int forceJulian, int if60secformat );
QSASTIME_static void normalize_MJD( MJDtime *MJD );
QSASTIME_static const char * getDayOfWeek( const MJDtime *MJD );
QSASTIME_static const char * getLongDayOfWeek( const MJDtime *MJD );
QSASTIME_static const char * getMonth( int m );
QSASTIME_static const char * getLongMonth( int m );
QSASTIME_static void getYAD( int *year, int *ifleapyear, int *doy, const MJDtime *MJD, int forceJulian );

#endif