[Python-Dev] datetime module enhancements

"Martin v. Löwis" martin at v.loewis.de
Fri Mar 9 21:00:16 CET 2007


BJörn Lindqvist schrieb:

>> If you extend the range to 64 bits there's no problem: the first
>> should print 32503680000, the second -2208988800.
> 
> I think it should be a ValueError, given that the programmer is very
> likely to further use the returned timestamp to for example insert
> stuff in a database. 

Then this operation (the insertion into a database) should give a
ValueError. Python conceptually has only a single integer type, and
that has no range limitation.

Of course, if "conversion to time_t" was an operation in datetime,
than this should limit it in the range of time_t (which may or
may not have 32 bits).

> Unix timestamps are not unambiguously defined for
> any years other than 1970 to 2038 imho.

As others have said: this is simply not true. It depends on
the hardware, Unix explicitly, deliberately, leaves that open
to the specific operating system implementation. On a 36-bit
hardware, the range will be different.

Regards,
Martin


More information about the Python-Dev mailing list