From be1eb0d9edc4720d97b2f5eac085d77b6dd34346 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 8 Dec 1997 21:56:43 +0000 Subject: (1) call mktime() just before strftime(); it normalizes the buffer and may set the timezone name for BSD systems... (2) fake all of the timezone variables for the mac. --- Modules/timemodule.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 3fedfa6..ce16ecc 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -321,6 +321,7 @@ time_strftime(self, args) buf.tm_mon--; buf.tm_wday = (buf.tm_wday + 1) % 7; buf.tm_yday--; + (void) mktime(&buf); /* I hate these functions that presume you know how big the output * will be ahead of time... */ @@ -471,8 +472,15 @@ inittime() } #else #ifdef macintosh + /* The only thing we can obtain is the current timezone + ** (and whether dst is currently _active_, but that is not what + ** we're looking for:-( ) + */ initmactimezone(); ins(d, "timezone", PyInt_FromLong(timezone)); + ins(d, "altzone", PyInt_FromLong(timezone)); + ins(d, "daylight", PyInt_FromLong((long)0)); + ins(d, "tzname", Py_BuildValue("(zz)", "", "")); #endif /* macintosh */ #endif /* HAVE_TM_ZONE */ #endif /* !HAVE_TZNAME */ -- cgit v0.12