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 ----
|