diff options
author | Guido van Rossum <guido@python.org> | 1998-04-27 19:04:26 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-04-27 19:04:26 (GMT) |
commit | 1f41f846a3fc369c4d68eee962a059ca3a51ccf3 (patch) | |
tree | d676ed29f64578593c7ce67a92102334fa48b666 /Modules | |
parent | d30dc0a55ef1c9987babe52c1af390c807808c05 (diff) | |
download | cpython-1f41f846a3fc369c4d68eee962a059ca3a51ccf3.zip cpython-1f41f846a3fc369c4d68eee962a059ca3a51ccf3.tar.gz cpython-1f41f846a3fc369c4d68eee962a059ca3a51ccf3.tar.bz2 |
Instead of calling mktime(), which has all sorts of unwanted side
effects, simply zero out the struct tm buffer before using it; this
should take care of the BSD folks' concern just as well.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/timemodule.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 8f5695d..6c938c2 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -304,6 +304,8 @@ time_strftime(self, args) char *outbuf = 0; int i; + memset((ANY *) &buf, '\0', sizeof(buf)); + if (!PyArg_ParseTuple(args, "s(iiiiiiiii)", &fmt, &(buf.tm_year), @@ -321,12 +323,6 @@ time_strftime(self, args) buf.tm_mon--; buf.tm_wday = (buf.tm_wday + 1) % 7; buf.tm_yday--; -#ifdef HAVE_MKTIME - /* This call is only there to adjust the numbers to be within - bounds. When we don't have mktime(), we say the caller is - responsible for that... */ - (void) mktime(&buf); -#endif /* I hate these functions that presume you know how big the output * will be ahead of time... */ |