range of mktime

Calvelo Daniel dcalvelo at pharion.univ-lille2.fr
Tue Oct 3 05:18:15 EDT 2000


bob van der Poel  <bvdpoel at uniserve.com> wrote:

: Using time.mktime() it appears that on my linux box the valid range is
: 1902...2038. Is this platform consistent, or, if not, is there a way to
: determine at runtime the valid range?

Aahz Maruch reacted immediately:

: That surprises me mildly; the usual range is 1970 to 2038 (matching the
: range of the Unix 32-bit clock).  You may want to use mxDateTime instead
: for greater range, precision, and utility.

It's 32-bit, but signed. The 32-bit-Unix-range is then 1970+/-68 years:

>>> a = 2L**32
>>> a/365/3600/24 # rough years
136L
>>> 2038-1970
68

HTH, DCA

P.S. To answer the original question, I'm pretty sure that a 64-bit machine 
has 64-bit time_t. So I guess the range is not consistent across platforms.
But then The Source Remains Unread.

-- Daniel Calvelo Aros
     calvelo at lifl.fr



More information about the Python-list mailing list