[Python-checkins] python/dist/src/Modules datetimemodule.c,1.31,1.32
tim_one@users.sourceforge.net
tim_one@users.sourceforge.net
2003年1月04日 10:17:38 -0800
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv13081/Modules
Modified Files:
datetimemodule.c
Log Message:
datetime_from_timet_and_us(): ignore leap seconds if the platform
localtime()/gmtime() insists on delivering them, + associated doc
changes.
Redid the docs for datetimtez.astimezone().
Index: datetimemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** datetimemodule.c 4 Jan 2003 06:03:15 -0000 1.31
--- datetimemodule.c 4 Jan 2003 18:17:36 -0000 1.32
***************
*** 2832,2836 ****
tm = f(&timet);
! if (tm)
result = PyObject_CallFunction(cls, "iiiiiii",
tm->tm_year + 1900,
--- 2832,2844 ----
tm = f(&timet);
! if (tm) {
! /* The platform localtime/gmtime may insert leap seconds,
! * indicated by tm->tm_sec > 59. We don't care about them,
! * except to the extent that passing them on to the datetime
! * constructor would raise ValueError for a reason that
! * made no sense to the user.
! */
! if (tm->tm_sec > 59)
! tm->tm_sec = 59;
result = PyObject_CallFunction(cls, "iiiiiii",
tm->tm_year + 1900,
***************
*** 2841,2844 ****
--- 2849,2853 ----
tm->tm_sec,
us);
+ }
else
PyErr_SetString(PyExc_ValueError,