Go to the documentation of this file. 1 #define LEAPSEC_DAT "leapsec.dat"
2 #define JD_1993 2448988.5
3 #define SECONDS_IN_DAY 86400
4 #define MAX_LEAP_SECONDS 32
5 #define UNIX_TIME_AT_1993 725846400.0
16 char leapsecdat[FILENAME_MAX];
18 if (!leap_seconds_tai93[0]) {
19 if ((varRoot = getenv(
"OCVARROOT")) ==
NULL) {
20 printf(
"-E- OCVARROOT environment variable is not defined.\n");
23 snprintf(leapsecdat, FILENAME_MAX,
"%s/common/tai-utc.dat", varRoot);
24 FILE *file_h = fopen(leapsecdat,
"rb");
26 snprintf(leapsecdat, FILENAME_MAX,
"%s/viirsn/IETTime.dat", varRoot);
27 file_h = fopen(leapsecdat,
"rb");
29 snprintf(leapsecdat, FILENAME_MAX,
"%s/modis/leapsec.dat", varRoot);
30 file_h = fopen(leapsecdat,
"rb");
32 printf(
"-E- %s:%d - leap second file (%s/common/tai-utc.dat) not found.\n", __FILE__, __LINE__, varRoot);
39 while (fgetc(file_h) !=
'\n')
41 while (fscanf(file_h,
" %d %*s %*d =JD %f%*[^\n]", &
year, &
jd) == 2) {
47 printf(
"-E- %s:%d - max leap seconds reached in %s\n", __FILE__, __LINE__, leapsecdat);
64 if (tai93time < leap_seconds_tai93[
i]) {
77 if (unixtime < leap_seconds_unix[
i]) {
void init_leapsecond_arrays()
#define UNIX_TIME_AT_1993
int leapseconds_since_1993_unix(double unixtime)
int leapseconds_since_1993(double tai93time)