]> granicus.if.org Git - python/commitdiff
Instead of calling mktime(), which has all sorts of unwanted side
authorGuido van Rossum <guido@python.org>
Mon, 27 Apr 1998 19:04:26 +0000 (19:04 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 27 Apr 1998 19:04:26 +0000 (19:04 +0000)
effects, simply zero out the struct tm buffer before using it; this
should take care of the BSD folks' concern just as well.

Modules/timemodule.c

index 8f5695dab4a683b2923e078e40cd711497d4e73a..6c938c243020457e7f28fe13440028ad8b51299e 100644 (file)
@@ -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...
         */