A sphere with three ocean waves in differing shades of blue. Next to the sphere, there is the bolded text "Ocean Color". Under that, there are two acronyms, separated by a vertical pipe: OB.DAAC (Ocean Biology Distributed Active Archive Center) and OBPG (Ocean Biology Processing Group).
Lorem
ipsum
dolor
sit
amet
Toggle navigation
Ocean Color Science Software
Jump to content
ocssw
V2022
web
ocssw
ocssw_src
oel_util
libtimeutils
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
}
unix_to_tai93
double unix_to_tai93(double unixtime)
Definition:
yds2tai.c:11
yds2unix
double yds2unix(int16_t year, int16_t day, double secs)
Definition:
yds2unix.c:7
tai58_to_unix
double tai58_to_unix(double tai58)
Definition:
yds2tai.c:29
leapseconds_since_1993_unix
int leapseconds_since_1993_unix(double unixtime)
Definition:
leapsecond.c:71
leapseconds_since_1993
int leapseconds_since_1993(double tai93time)
Definition:
leapsecond.c:58
yds2tai93
double yds2tai93(int16_t iyr, int16_t idy, double sec)
Definition:
yds2tai.c:4
unix_to_tai58
double unix_to_tai58(double unixtime)
Definition:
yds2tai.c:23
tai93_to_unix
double tai93_to_unix(double tai93)
Definition:
yds2tai.c:16
timeutils.h
idy
int32_t idy
Definition:
atrem_corl1.h:161
iyr
int32_t iyr
Definition:
atrem_corl1.h:161