Richard Shapiro <rashapir...@gmail.com> added the comment:

Here's a patch to normalize the results of the various system calls
which return time information. This was against the source for Python 2.5.1.

*** timemodule.c        Tue Sep  8 10:28:31 2009
--- /home/rshapiro/216/redist/Python-2.5.1/Modules/timemodule.c.dist    Mon
Jan 12 22:53:07 2009
***************
*** 241,247 ****
  static PyObject *
  tmtotuple(struct tm *p)
  {
-         long dstval;
        PyObject *v = PyStructSequence_New(&StructTimeType);
        if (v == NULL)
                return NULL;
--- 241,246 ----
***************
*** 256,271 ****
        SET(5, p->tm_sec);
        SET(6, (p->tm_wday + 6) % 7); /* Want Monday == 0 */
        SET(7, p->tm_yday + 1);    /* Want January, 1 == 1 */
!         /* Alas, on some platforms tm_isdst can be something other
than -1, 0, or 1 */
!         if (p->tm_isdst < 0) {
!           dstval = -1;
!         } else if (p->tm_isdst > 0) {
!           dstval = 1;
!         } else {
!           dstval = 0;
!         }
! 
!       SET(8, dstval);
  #undef SET
        if (PyErr_Occurred()) {
                Py_XDECREF(v);
--- 255,261 ----
        SET(5, p->tm_sec);
        SET(6, (p->tm_wday + 6) % 7); /* Want Monday == 0 */
        SET(7, p->tm_yday + 1);    /* Want January, 1 == 1 */
!       SET(8, p->tm_isdst);
  #undef SET
        if (PyErr_Occurred()) {
                Py_XDECREF(v);
(t)neo:/home/rshapiro/216/redist/patch/Python-2.5.1/Modules 140 %

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6823>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to