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
date2ydmsec.c
Go to the documentation of this file.
1 #include <timeutils.h>
2 #include <genutils.h>
3 
4 void date2ydmsec(char *date, int32_t *year, int32_t *day, int32_t *msec) {
5  int yy, mm, dd, hh, mn, sc, cc;
6 
7  int count = sscanf(date, "%4d%2d%2d%2d%2d%2d%2d",
8  &yy, &mm, &dd, &hh, &mn, &sc, &cc);
9  if(count != 7) {
10  *year = BAD_INT;
11  *day = BAD_INT;
12  *msec = BAD_INT;
13  return;
14  }
15 
16  ymdhms2ydmsec(yy, mm, dd, hh, mn, sc, year, day, msec);
17  *msec = *msec + (int32_t) cc * 10;
18 }
19 
20 void isodate2ydmsec(char *date, int32_t *year, int32_t *day, int32_t *msec) {
21  int yy, mm, dd, hh, mn, sc;
22  int count = sscanf(date, "%4d-%2d-%2dT%2d:%2d:%2dZ",
23  &yy, &mm, &dd, &hh, &mn, &sc);
24  if(count != 6) {
25  *year = BAD_INT;
26  *day = BAD_INT;
27  *msec = BAD_INT;
28  return;
29  }
30 
31  ymdhms2ydmsec(yy, mm, dd, hh, mn, sc, year, day, msec);
32 }
33 
int32_t day
int32 * msec
Definition: l1_czcs_hdf.c:31
void isodate2ydmsec(char *date, int32_t *year, int32_t *day, int32_t *msec)
Definition: date2ydmsec.c:20
void ymdhms2ydmsec(int yy, int mm, int dd, int hh, int mn, int sc, int32_t *year, int32_t *day, int32_t *msec)
Definition: ydhms2ydmsec.c:3
void date2ydmsec(char *date, int32_t *year, int32_t *day, int32_t *msec)
Definition: date2ydmsec.c:4
#define BAD_INT
Definition: genutils.h:23
int count
Definition: decode_rs.h:79