Author rshapiro
Recipients brett.cannon, georg.brandl, rshapiro
Date 2009-09-08.14:43:02
SpamBayes Score 9.10294e-09
Marked as misclassified No
Message-id <1252420985.69.0.912324758726.issue6823@psf.upfronthosting.co.za>
In-reply-to
Content
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 %
History
Date User Action Args
2009-09-08 14:43:06rshapirosetrecipients: + rshapiro, brett.cannon, georg.brandl
2009-09-08 14:43:05rshapirosetmessageid: <1252420985.69.0.912324758726.issue6823@psf.upfronthosting.co.za>
2009-09-08 14:43:04rshapirolinkissue6823 messages
2009-09-08 14:43:03rshapirocreate