summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-12-08 21:56:43 (GMT)
committerGuido van Rossum <guido@python.org>1997-12-08 21:56:43 (GMT)
commitbe1eb0d9edc4720d97b2f5eac085d77b6dd34346 (patch)
tree95c734d604c9e726b1e089e412911b50d4cc8a69
parent6a99984e79b9779d54f71691cb8b1dca718862a7 (diff)
downloadcpython-be1eb0d9edc4720d97b2f5eac085d77b6dd34346.zip
cpython-be1eb0d9edc4720d97b2f5eac085d77b6dd34346.tar.gz
cpython-be1eb0d9edc4720d97b2f5eac085d77b6dd34346.tar.bz2
(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.
-rw-r--r--Modules/timemodule.c8
1 files changed, 8 insertions, 0 deletions
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 */