diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-09-12 11:31:16 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-09-12 11:31:16 +0800 |
commit | 535e458a1b28ecdf69dddcace060807e462980fd (patch) | |
tree | 6321dcb267e99a267c85cc113695e27b76cb1f70 /mbbsd/osdep.c | |
parent | fa932118b9ab9bffa96c1e73ab4aa982f60292cb (diff) | |
download | pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar.gz pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar.bz2 pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar.lz pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar.xz pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.tar.zst pttbbs-535e458a1b28ecdf69dddcace060807e462980fd.zip |
Solaris compatible
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2193 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
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 /* ------------------------------------------------------------------------ */ |