[Python-Dev] Vacation and possibly a new bug

Tim Peters tim.one@comcast.net
Tue, 22 Jul 2003 20:20:57 -0400


>> If dividend and divisor are both positive and integer, C's / is
>> flooring division.

[Brett C.]
> That's what I figured.  Although isn't that assuming time_t is an int
> or long or something?

The grownup phrase is "integral type" <wink>.  You're right that it's a
dubious assumption:  all C requires of time_t is that it resolves to an
arithmetic type.  "Arithmetic type" is the union of the integral, real, and
(in C99) complex types.  With FPUs much faster than they used to be, and
32-bit ints running out of room to store seconds since 1970:

>>> import datetime as d
>>> print d.datetime(1970, 1, 1) + d.timedelta(seconds=2**31-1)
2038-01-19 03:14:07
>>>

I wouldn't be surprised to see some systems switching to doubles for time_t.
Probably not this decade, although the JavaScript (ECMAScript) time type was
deliberately designed to work beautifully when stored in an IEEE-754 double,
and has much greater range and precision than the typical  POSIX time type.

> But the entire chunk of code seems to assuming that so what is one
> more spot of code.  =)

I'll be dead by 2038 -- this is my generation's way of giving employment
security to yours <wink>.