Due to the lapse in federal government funding, NASA is not updating this website. We sincerely regret this inconvenience.
NASA Logo
Ocean Color Science Software

ocssw V2022
yds2tai.c
Go to the documentation of this file.
1 #include <stdint.h>
2 #include <timeutils.h>
3 
4 double yds2tai93(int16_t iyr, int16_t idy, double sec) {
5  // add the seconds after the conversion to TAI93 so the leap second
6  // is not lost
7  double unixTime = yds2unix(iyr, idy, 0.0);
8  return unix_to_tai93(unixTime) + sec;
9 }
10 
11 double unix_to_tai93(double unixtime) {
12  double tai93 = unixtime - 725846400; // seconds between 1970 and 1993
13  return tai93 + leapseconds_since_1993_unix(unixtime); // TAI includes leap seconds
14 }
15 
16 double tai93_to_unix(double tai93) {
17  double unixtime = tai93 - leapseconds_since_1993(tai93);
18  return unixtime + 725846400;
19 }
20 
21 // The TAI58 routines will have the wrong number of leap seconds
22 // for times before 1993.
23 double unix_to_tai58(double unixtime) {
24  // seconds between UTC 1993 and UTC 1958 = 1104537600
25  // plus leap seconds between 1993 and 1958 = 27
26  return unix_to_tai93(unixtime) + 1104537600.0 + 27.0;
27 }
28 
29 double tai58_to_unix(double tai58) {
30  return tai93_to_unix(tai58 - 1104537600.0 - 27.0);
31 }
double unix_to_tai93(double unixtime)
Definition: yds2tai.c:11
double yds2unix(int16_t year, int16_t day, double secs)
Definition: yds2unix.c:7
double tai58_to_unix(double tai58)
Definition: yds2tai.c:29
int leapseconds_since_1993_unix(double unixtime)
Definition: leapsecond.c:71
int leapseconds_since_1993(double tai93time)
Definition: leapsecond.c:58
double yds2tai93(int16_t iyr, int16_t idy, double sec)
Definition: yds2tai.c:4
double unix_to_tai58(double unixtime)
Definition: yds2tai.c:23
double tai93_to_unix(double tai93)
Definition: yds2tai.c:16
int32_t idy
Definition: atrem_corl1.h:161
int32_t iyr
Definition: atrem_corl1.h:161