This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Python 2.4.1-1 time.altzone does not include DST offset
- From: Christian Franke <Christian dot Franke at t-online dot de>
- To: cygwin at cygwin dot com
- Date: Mon, 15 May 2006 20:39:26 +0200
- Subject: Re: Python 2.4.1-1 time.altzone does not include DST offset
- References: <44671C44.7050309@t-online.de>
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
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__*/
}
--
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/