diff options
Diffstat (limited to 'mbbsd/osdep.c')
-rw-r--r-- | mbbsd/osdep.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/mbbsd/osdep.c b/mbbsd/osdep.c index 1bca7208..598cc5fd 100644 --- a/mbbsd/osdep.c +++ b/mbbsd/osdep.c @@ -76,6 +76,36 @@ strlcat(dst, src, siz) #endif +#ifdef NEED_TIMEGM + +#include <time.h> +#include <stdlib.h> + +time_t timegm (struct tm *tm) +{ + time_t ret; + char *tz; + + tz = getenv("TZ"); + putenv("TZ="); + tzset(); + ret = mktime(tm); + + if (tz){ + char *buff = malloc( strlen(tz) + 10); + sprintf( buff, "TZ=%s", tz); + putenv(buff); + free(buff); + } + else + unsetenv("TZ"); + tzset(); + + return ret; +} + +#endif + #ifdef NEED_STRLCPY /* ------------------------------------------------------------------------ */ |