aboutsummaryrefslogtreecommitdiffstats
path: root/skeletons
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-08-12 03:58:25 +0000
committerLev Walkin <vlm@lionet.info>2004-08-12 03:58:25 +0000
commitdb42400f4e7190650cc12ec62bef20da09f8d7a9 (patch)
tree834604d5543e06682a40907f1d6a6eae0aa3632b /skeletons
parent02a315573749209b2f8ca1394ecbc65a53236758 (diff)
portability
Diffstat (limited to 'skeletons')
-rw-r--r--skeletons/GeneralizedTime.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c
index c9b05de5..f17b4393 100644
--- a/skeletons/GeneralizedTime.c
+++ b/skeletons/GeneralizedTime.c
@@ -32,6 +32,24 @@ static struct tm *gmtime_r(time_t *tloc, struct tm *result) {
return 0;
}
+#define tzset() _tzset()
+static time_t timegm(struct tm *tm) {
+ time_t tloc;
+ char *tz;
+
+ tz = getenv("TZ");
+ setenv("TZ", "", 1);
+ tzset();
+ tloc = mktime(tm);
+ if (tz)
+ setenv("TZ", tz, 1);
+ else
+ unsetenv("TZ");
+ tzset();
+ return tloc;
+}
+
+#if 0 /* Alternate version */
/* vlm: I am not sure about validity of this algorithm. */
static time_t timegm(struct tm *tm) {
struct tm tmp;
@@ -42,7 +60,7 @@ static time_t timegm(struct tm *tm) {
tm->tm_gmtoff = 0; /* Simulate GMT */
return tloc;
}
-
+#endif
#endif /* WIN32 */
#ifndef __NO_ASN_TABLE__