Fix building on Linux
This commit is contained in:
parent
be160742cf
commit
6e95015578
@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
# include <sys/file.h>
|
||||||
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -3659,7 +3662,9 @@ static time_t _cmgr_pdu_parse_timestamp(char const * timestamp)
|
|||||||
size_t i;
|
size_t i;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
#ifndef __linux__
|
||||||
timezone_t tz;
|
timezone_t tz;
|
||||||
|
#endif
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
char buf[32];
|
char buf[32];
|
||||||
#endif
|
#endif
|
||||||
@ -3686,10 +3691,14 @@ static time_t _cmgr_pdu_parse_timestamp(char const * timestamp)
|
|||||||
strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M:%S", &tm);
|
strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M:%S", &tm);
|
||||||
fprintf(stderr, "DEBUG: %s() => \"%s\"\n", __func__, buf);
|
fprintf(stderr, "DEBUG: %s() => \"%s\"\n", __func__, buf);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __linux__
|
||||||
|
t = mktime(&tm);
|
||||||
|
#else
|
||||||
/* XXX assumes UTC */
|
/* XXX assumes UTC */
|
||||||
tz = tzalloc("UTC");
|
tz = tzalloc("UTC");
|
||||||
t = mktime_z(tz, &tm);
|
t = mktime_z(tz, &tm);
|
||||||
tzfree(tz);
|
tzfree(tz);
|
||||||
|
#endif
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user