Mail Archives: cygwin/2006/05/15/14:40:20
--------------040509080605040605050401
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
> Python's time.altzone is equal to time.timezone, it should be
> time.timezone-3600 (for CEST)
>
> $ python -c 'import time; time.tzset(); print time.ctime(), \
> time.daylight, time.timezone, time.altzone, time.tzname'
> Sun May 14 13:46:55 2006 1 -3600 -3600 (' ', ' ')
On Cygwin, time.altzone is always set equal to time.timezone.
The attached patch should fix this for most timezones.
The function already uses the same heuristics in the !__CYGWIN__ &&
!HAVE_STRUCT_TM_TM_ZONE case.
Christian
--------------040509080605040605050401
Content-Type: text/plain;
name="python-altzone-patch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="python-altzone-patch.txt"
diff -r -U 6 -p python-2.4.1-1.orig/Modules/timemodule.c python-2.4.1-1/Modules/timemodule.c
--- python-2.4.1-1.orig/Modules/timemodule.c 2004-08-03 19:58:55.001000000 +0200
+++ python-2.4.1-1/Modules/timemodule.c 2006-05-15 16:53:55.171875000 +0200
@@ -697,13 +697,13 @@ void inittimezone(PyObject *m) {
}
#else
#endif /* HAVE_STRUCT_TM_TM_ZONE */
#ifdef __CYGWIN__
tzset();
PyModule_AddIntConstant(m, "timezone", _timezone);
- PyModule_AddIntConstant(m, "altzone", _timezone);
+ PyModule_AddIntConstant(m, "altzone", _timezone-3600);
PyModule_AddIntConstant(m, "daylight", _daylight);
PyModule_AddObject(m, "tzname",
Py_BuildValue("(zz)", _tzname[0], _tzname[1]));
#endif /* __CYGWIN__ */
#endif /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/
}
--------------040509080605040605050401
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--------------040509080605040605050401--
- Raw text -