Go to the documentation of this file.
13 static char string[30];
17 return "Undefined time";
20 itime = (time_t) dtime;
26 ts = localtime(&itime);
29 fprintf(
stderr,
"-W- %s line %d: ", __FILE__, __LINE__);
30 fprintf(
stderr,
"Bad timezone argument passed to unix2isodate().\n");
35 int fracSec = floor(1000 * (dtime - itime) + 0.0005);
36 if (fracSec == 1000) {
41 sprintf(
string,
"%d-%02d-%02dT%02d:%02d:%02d.%03.0f", ts->tm_year + 1900, ts->tm_mon + 1,
42 ts->tm_mday, ts->tm_hour, ts->tm_min, ts->tm_sec, (
float) fracSec);
49 sprintf(tzone,
"%+03d", (
int) ts->tm_gmtoff / 3600);
50 strcat(
string, tzone);
53 fprintf(
stderr,
"-W- %s line %d: ", __FILE__, __LINE__);
54 fprintf(
stderr,
"Bad timezone argument passed to unix2isodate().\n");
63 strptime(isodate,
"%Y-%m-%dT%H:%M:%S", &trec);
64 double secSince = mktime(&trec) -
gmt_offset();
65 char* ptr = strchr(isodate,
'.');
67 double fracsecs = atof(ptr);
char * unix2isodate(double dtime, char zone)
double isodate2unix(const char *isodate)