das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
tt2000.h
Go to the documentation of this file.
1
4#ifndef _tt2000_h_
5#define _tt2000_h_
6
7#include <stdbool.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/* The UTC origin is funny due to leap seconds and makes it appear as if
14 * the TT2000 JD origin is: 2451544.9992571296296296 instead. */
15#define DAS_TT2000_JD_ORIGIN 2451545.0
16
17/* das_init() loads the leap second table. After that the conversions below
18 are thread safe. */
19
26bool das_tt2k_reinit(const char* sProgName);
27
28/* Renamed CDF UTC to TT2000 handling function to avoid namespace
29 * conflicts. Roughly corresponds to computeTT2000 in original sources.
30 *
31 * Var Arg Warning! This function expects DOUBLES. Since it's a var-arg
32 * function it will accept *any* argument after the day value but it will
33 * blindly treat all arguments as doubles. Up casting will *not* be
34 * preformed! This function is legacy code from the CDF libraries.
35 * use the safer alternative:
36 *
37 * das_time dt;
38 * tt = Units_convertFromDt(&dt, UNIT_TT2000);
39 *
40 * instead. You have been warned.
41 *
42 * Thread Safety: Function is thread safe so long as das_tt2k_init() or
43 * das_tt2k_reinit() are *not* called from another thread.
44 */
45long long das_utc_to_tt2K(double year, double month, double day, ...);
46
47/* Renamed CDF TT2000 to UTC function, renamed to avoid nomespace conflicts.
48 * Corresponds to breakdownTT2000 in original sources.
49 *
50 * Var Arg Warning! This function expects DOUBLES. Since it's a var-arg
51 * function it will accept *any* argument after the day value but it will
52 * blindly treat all arguments as pointers to doubles. Up casting will
53 * *not* be preformed! This function is legacy code from the CDF libraries.
54 * use the safer alternative:
55 *
56 * das_time dt;
57 * Units_convertToDt(&dt, tt, UNIT_TT2000);
58 *
59 * instead. You have been warned.
60 *
61 * Thread Safety: Function is thread safe so long as das_tt2k_init() or
62 * das_tt2k_reinit() are *not* called from another thread.
63 */
64void das_tt2K_to_utc(
65 long long nanoSecSinceJ2000, double* ly, double* lm, double* ld, ...
66);
67
68/* Convert a UNIT_TT2000 double to UNIT_US2000 double
69 *
70 * This is a direct conversion of value on the UNIT_TT2000 scale to values on
71 * the UNIT_US2000 scale without a round trip through UTC broken out times.
72 *
73 * Used by conversion functions in units.c.
74 *
75 * WARNING: US2000 has no leap seconds so near a leap second two different
76 * TT2000 times will convert to the same US2000 time
77 *
78 * Does not check the TT2000 mutex, thread safe so long as das_tt2k_init()
79 * or das_tt2k_reinit() are not called from another thread.
80 */
81double das_tt2K_to_us2K(double tt2000);
82
83/* Convert a UNIT_US2000 double to UNIT_TT2000 double
84 *
85 * This is a direct conversion of value on the UNIT_US2000 scale to values on
86 * the UNIT_TT2000 scale without a round trip through UTC broken out times.
87 *
88 * Used by conversion functions in units.c.
89 *
90 * NOTE: Near a leap second two US2000 values that are 1 second apart will
91 * appear as 2 seconds apart on the TT2000 scale.
92 *
93 *
94 * Does not check the TT2000 mutex, thread safe so long as das_tt2k_init()
95 * or das_tt2k_reinit() are not called from another thread.
96 */
97double das_us2K_to_tt2K(double us2000);
98
99#ifdef __cplusplus
100}
101#endif
102
103#endif /* _tt2000_h_ */