NASA Logo
Ocean Color Science Software

ocssw V2022
timeutils.h File Reference
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
Include dependency graph for timeutils.h:

Go to the source code of this file.

Macros

#define SECONDS_IN_DAY   86400
 

Functions

int isleap (int year)
 
time_t gmt_offset (void)
 
double yds2unix (int16_t year, int16_t day, double secs)
 
double yds2unix_ (int16_t *year, int16_t *day, double *secs)
 
void unix2yds (double usec, int16_t *year, int16_t *day, double *secs)
 
char * unix2ydhmsf (double usec, char zone)
 
double ymds2unix (int16_t year, int16_t month, int16_t day, double secs)
 
void unix2ymds (double usec, int16_t *year, int16_t *mon, int16_t *day, double *secs)
 
void unix2ymdhms (double usec, int16_t *year, int16_t *mon, int16_t *day, int16_t *hour, int16_t *min, double *sec)
 
void yd2md (int16_t year, int16_t doy, int16_t *month, int16_t *dom)
 
char * ydhmsf (double dtime, char zone)
 
double now (void)
 
void ymdhms2ydmsec (int yy, int mm, int dd, int hh, int mn, int sc, int32_t *year, int32_t *day, int32_t *msec)
 
void date2ydmsec (char *date, int32_t *year, int32_t *day, int32_t *msec)
 
char * unix2isodate (double dtime, char zone)
 
double isodate2unix (const char *isodate)
 
void isodate2ydmsec (char *date, int32_t *year, int32_t *day, int32_t *msec)
 
void isodate2ymds (const char *isodate, int16_t *year, int16_t *month, int16_t *day, double *sec)
 
double zulu2unix (char *zulu)
 
void addmsec (int32_t *year, int32_t *day, int32_t *msec, int32_t delta)
 
void get_time (char *pr_time)
 
int leapseconds_since_1993 (double tai93time)
 
int leapseconds_since_1993_unix (double unixtime)
 
double unix_to_tai93 (double unixtime)
 
double tai93_to_unix (double tai93)
 
double unix_to_tai58 (double unixtime)
 
double tai58_to_unix (double tai58)
 
int32_t jday (int16_t year, int16_t month, int16_t day)
 
int jdate (int32_t julianDay, int32_t *year, int32_t *dayOfYear)
 
double yds2tai93 (int16_t iyr, int16_t idy, double sec)
 
int ccsds_to_yds (uint8_t *cctime, int32_t *iyear, int32_t *iday, double *sec)
 
double udunits2unix (const char *str)
 
const char * unix2udunits_c (double unixtime, int hasZ)
 

Macro Definition Documentation

◆ SECONDS_IN_DAY

#define SECONDS_IN_DAY   86400

Definition at line 11 of file timeutils.h.

Function Documentation

◆ addmsec()

void addmsec ( int32_t *  year,
int32_t *  day,
int32_t *  msec,
int32_t  delta 
)

Definition at line 3 of file addmsec.c.

◆ ccsds_to_yds()

int ccsds_to_yds ( uint8_t *  cctime,
int32_t *  iyear,
int32_t *  iday,
double *  sec 
)

Definition at line 5 of file ccsds_to_yds.c.

◆ date2ydmsec()

void date2ydmsec ( char *  date,
int32_t *  year,
int32_t *  day,
int32_t *  msec 
)

Definition at line 4 of file date2ydmsec.c.

◆ get_time()

void get_time ( char *  pr_time)

Definition at line 28 of file get_time.c.

◆ gmt_offset()

time_t gmt_offset ( void  )

Definition at line 8 of file gmt_offset.c.

◆ isleap()

int isleap ( int  year)

Definition at line 3 of file isleap.c.

◆ isodate2unix()

double isodate2unix ( const char *  isodate)

Definition at line 61 of file unix2isodate.c.

◆ isodate2ydmsec()

void isodate2ydmsec ( char *  date,
int32_t *  year,
int32_t *  day,
int32_t *  msec 
)

Definition at line 20 of file date2ydmsec.c.

◆ isodate2ymds()

void isodate2ymds ( const char *  isodate,
int16_t *  year,
int16_t *  month,
int16_t *  day,
double *  sec 
)

Definition at line 73 of file unix2isodate.c.

◆ jdate()

int jdate ( int32_t  julianDay,
int32_t *  year,
int32_t *  dayOfYear 
)

Takes in a julian day and mutates year and doy to contain the gregorian year and day of that gregorian year of that julian day.

Parameters
julianDayThe Julian day to be converted
yearOut-parameter indicating the gregorian year that julianDay is in
dayOfYearOut-parameter indicating the number of days into the gregorian year that julianDay is.

Definition at line 13 of file jdate.c.

◆ jday()

int32_t jday ( int16_t  year,
int16_t  month,
int16_t  day 
)

Converts a calendar date to the corresponding Julian day starting at noon on the calendar date. Originally implemented by Frederick S. Patt, GSC, November 4 1992. [Van] Flandern and Pulkkinen, Ap. J. Supplement Series 41, November 1979, p. 400.

Parameters
year4-digit year
month1-12
day1-31
Returns
The astronomical Julian day corresponding to the one starting at noon on the calendar day

Definition at line 14 of file jday.c.

◆ leapseconds_since_1993()

int leapseconds_since_1993 ( double  tai93time)

Definition at line 58 of file leapsecond.c.

◆ leapseconds_since_1993_unix()

int leapseconds_since_1993_unix ( double  unixtime)

Definition at line 71 of file leapsecond.c.

◆ now()

double now ( void  )

Definition at line 361 of file HISTORY.txt.

◆ tai58_to_unix()

double tai58_to_unix ( double  tai58)

Definition at line 29 of file yds2tai.c.

◆ tai93_to_unix()

double tai93_to_unix ( double  tai93)

Definition at line 16 of file yds2tai.c.

◆ udunits2unix()

double udunits2unix ( const char *  str)

Definition at line 116 of file udunits2unix.cpp.

◆ unix2isodate()

char* unix2isodate ( double  dtime,
char  zone 
)

creates a time string "1994-11-05T13:15:30.123Z"

Parameters
dtimeunix time as a double
zonetime zone character 'G'=gmt, 'L'=local
Returns
ISO 8601 time string (internal memory)

Definition at line 10 of file unix2isodate.c.

◆ unix2udunits_c()

const char* unix2udunits_c ( double  unixtime,
int  hasZ 
)

Definition at line 121 of file udunits2unix.cpp.

◆ unix2ydhmsf()

char* unix2ydhmsf ( double  usec,
char  zone 
)

Definition at line 8 of file unix2ydhmsf.c.

◆ unix2yds()

void unix2yds ( double  usec,
int16_t *  year,
int16_t *  day,
double *  secs 
)

Definition at line 7 of file unix2yds.c.

◆ unix2ymdhms()

void unix2ymdhms ( double  usec,
int16_t *  year,
int16_t *  mon,
int16_t *  day,
int16_t *  hour,
int16_t *  min,
double *  sec 
)

Definition at line 8 of file unix2ymdhms.c.

◆ unix2ymds()

void unix2ymds ( double  usec,
int16_t *  year,
int16_t *  mon,
int16_t *  day,
double *  secs 
)

Definition at line 8 of file unix2ymds.c.

◆ unix_to_tai58()

double unix_to_tai58 ( double  unixtime)

Definition at line 23 of file yds2tai.c.

◆ unix_to_tai93()

double unix_to_tai93 ( double  unixtime)

Definition at line 11 of file yds2tai.c.

◆ yd2md()

void yd2md ( int16_t  year,
int16_t  doy,
int16_t *  month,
int16_t *  dom 
)

Definition at line 6 of file yd2md.c.

◆ ydhmsf()

char* ydhmsf ( double  dtime,
char  zone 
)

Definition at line 12 of file ydhmsf.c.

◆ yds2tai93()

double yds2tai93 ( int16_t  iyr,
int16_t  idy,
double  sec 
)

Definition at line 4 of file yds2tai.c.

◆ yds2unix()

double yds2unix ( int16_t  year,
int16_t  day,
double  secs 
)

Definition at line 7 of file yds2unix.c.

◆ yds2unix_()

double yds2unix_ ( int16_t *  year,
int16_t *  day,
double *  secs 
)

Definition at line 34 of file yds2unix.c.

◆ ymdhms2ydmsec()

void ymdhms2ydmsec ( int  yy,
int  mm,
int  dd,
int  hh,
int  mn,
int  sc,
int32_t *  year,
int32_t *  day,
int32_t *  msec 
)

Definition at line 3 of file ydhms2ydmsec.c.

◆ ymds2unix()

double ymds2unix ( int16_t  year,
int16_t  month,
int16_t  day,
double  secs 
)

Definition at line 9 of file ymds2unix.c.

◆ zulu2unix()

double zulu2unix ( char *  zulu)

Definition at line 3 of file zulu2unix.c.