This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: proposal: allow years before 1900
Type: enhancement Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: gvanrossum
Priority: low Keywords:

Created on 2001-03-08 21:55 by anonymous, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (2)
msg3794 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-03-08 21:55
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 ----

msg3795 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2001-03-22 00:33
Logged In: YES 
user_id=6380

I question the wisdom of this change.  It suggests that the
time module would support old dates, while in fact it has
almost no support for dates before 1970. The only thing it
would add is that you can use asctime() and strftime() for
dates before 1900, but I doubt that that is very useful
without full support. (E.g. you can't calculate what day of
the week 1/1/1800 is even with this change.)

So I'm rejecting this -- better catch bogus inputs early.
History
Date User Action Args
2022-04-10 16:03:50adminsetgithub: 34123
2001-03-08 21:55:57anonymouscreate