Bug in Calendar Module

Michael Tiomkin michael at camelot-it.com
Sun Jan 23 05:09:40 EST 2000


  Unfortunately, this is a bug.  The overflow exists only when you treat the time as a signed 32-bit
integer.  When you use time as unsigned integer, this will happen only around 1970+2**32/3e7, 2090?
It seems that the calendar time functions can have a workaround for this bug, in spite of the fact
that Python uses only signed integers.

  Michael

Ben Gertzfield wrote:

> >>>>> "Liew" == Liew Pol Yee <polyp at cyberway.com.sg> writes:
>
>     Liew> Hello! Does a fix for the Calendar Module calendar.py exist?
>     Liew> Currently, i get errors when I do the following: import
>     Liew> calendar new = calendar.monthcalendar(2038,2)
>
>     Liew> It seems to be unable to accept dates after January,
>     Liew> 2038. Thanks for any help!
>
> This is because you are on a system where the time is stored as a
> 32-bit integer, as the number of seconds since 1970.
>
> In 2038, the number of seconds since 1970 overflows the 32-bit limit,
> and a lot of programs will break.
>
> There isn't a good solution, except to use a system that has a 64-bit
> counter for time.
>
> Ben
>
> --
> Brought to you by the letters F and Q and the number 5.
> "It makes my nipples hard!"
> Debian GNU/Linux maintainer of Gimp and GTK+ -- http://www.debian.org/




More information about the Python-list mailing list