[Python-bugs-list] [ python-Bugs-407180 ] proposal: allow years before 1900

noreply@sourceforge.net noreply@sourceforge.net
Fri, 16 Mar 2001 09:51:48 -0800


Bugs item #407180, was updated on 2001-03-08 13:55
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=407180&group_id=5470

Category: Python Library
Group: Feature Request
Status: Open
>Priority: 4
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: proposal: allow years before 1900

Initial Comment:
Handling of years before 1900: proposed change for 
python 1.5.2-2.1

from http://www.python.org/doc/current/lib/module-
time.html:

>Values 100-1899 are always
>illegal. Note that this is new as of Python 1.5.2
(a2); earlier
>versions, up to Python 1.5.1 and 1.5.2a1, would add 
1900 to year
>values below 1900.

Wouldn't the correct behaviour be just to store years 
before 1900 into
tm_year as any other year in timemodule.c gettmarg()?  
They get stored
as negative values, but there shouldn't be any 
problems with that,
judging from glibc 2.2 behaviour, documentation for 
other libc's, and
the following quote from 
http://www.platinum.com/products/wp/wp_epmdt.htm:

"While tm_year is based on 1900, the full range of 
positive and
negative values are allowed. For 32-bit integers this 
allows for dates
from 2147481748 BCE to 2147485548 CE. "


Proposed patch for python 1.5.2:

*** timemodule.c.origi  Tue Apr  6 00:54:14 1999
--- timemodule.c        Thu Mar  8 23:32:55 2001
***************
*** 345,355 ****
                        y += 1900;
                else if (0 <= y && y <= 68)
                        y += 2000;
-               else {
-                       PyErr_SetString
(PyExc_ValueError,
-                                       "year out of 
range (00-99, 1900-*)");
-                       return 0;
-               }
        }
        p->tm_year = y - 1900;
        p->tm_mon--;
--- 345,350 ----



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=407180&group_id=5470