Toggle navigation
Ocean Color Science Software
Jump to content
ocssw
V2022
web
ocssw
ocssw_src
oel_util
libtimeutils
yds2unix.c
Go to the documentation of this file.
1
#include <
timeutils.h
>
2
3
/* -------------------------------------------------------------- */
4
/* yds2unix() - converts year and day of year to secs since 1/1/70 */
5
6
/* -------------------------------------------------------------- */
7
double
yds2unix
(int16_t
year
, int16_t
day
,
double
secs) {
8
double
usec;
9
struct
tm
trec;
10
time_t secSince;
11
12
/* */
13
/* calculate seconds from 1/1/70 to input year, day */
14
/* and correct to GMT */
15
/* */
16
trec.tm_year =
year
- 1900;
17
trec.tm_mon = 0;
18
trec.tm_mday =
day
;
19
trec.tm_hour = 0;
20
trec.tm_min = 0;
21
trec.tm_sec = 0;
22
trec.tm_isdst = 0;
23
secSince = mktime(&trec) -
gmt_offset
();
24
25
/* */
26
/* Now we total the seconds */
27
/* */
28
usec = secSince + secs;
29
30
return
usec;
31
}
32
33
/* make a FORTRAN function */
34
double
yds2unix_
(int16_t *
year
, int16_t *
day
,
double
*secs) {
35
return
(
yds2unix
(*
year
, *
day
, *secs));
36
}
day
int32_t day
Definition:
atrem_corl1v2.h:308
gmt_offset
time_t gmt_offset(void)
Definition:
gmt_offset.c:8
tm
float tm[MODELMAX]
Definition:
atrem_corl1v2.h:248
spacetrack_tles.year
year
Definition:
spacetrack_tles.py:170
yds2unix
double yds2unix(int16_t year, int16_t day, double secs)
Definition:
yds2unix.c:7
yds2unix_
double yds2unix_(int16_t *year, int16_t *day, double *secs)
Definition:
yds2unix.c:34
timeutils.h