[issue10827] Functions in time module should support year < 1900 when accept2dyear = 0
Alexander Belopolsky
report at bugs.python.org
Tue Jan 4 18:30:13 CET 2011
Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:
> The system libc would raise an error (return NULL) if it doesn't know
> how to format years older than 1900.
As experience with asctime has shown, system libc can do whatever it pleases with out of range values including overrunning a fixed size buffer, returning non-sensical values etc. However, now that we have control over asctime implemetation (see issue 8013), I don't see any problem in supporting at least year > 999 in time.asctime and time.ctime. (Supporting full [1900-maxint, maxint] range would involve a decision on whether to fill < 4-digit values.) Some extra care would be required for time.strftime() because some systems may not support year < 1900 as well as others.
It looks like POSIX does not make any strong mandates:
"tm_year is a signed value; therefore, years before 1900 may be represented."
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html
and regardless of what POSIX or C standards have to say, this is the area where systems a known to have spotty compliance records.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10827>
_______________________________________
More information about the Python-bugs-list
mailing list