[Zope] Weird interaction between int() and DateTime.timeTime

Shane Hathaway shane@digicool.com
Thu, 25 May 2000 12:56:48 -0400


andres@corrada.com wrote:
> 
> In a previous posting about Netscape Image problems I mentioned a weird
> interaction between int() and DateTime.timeTime(). I can reproduce the error
> within the python interpreter as follows-
> 
> Python 1.5.2 (#5, Jan  6 2000, 17:10:24)  [GCC egcs-2.91.66 19990314/Linux
> (egcs- on linux2
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> from DateTime import DateTime
> >>> h = 'Wed, 15 Mar 2000 19:02:17 GMT'
> >>> t = DateTime( h )
> >>> print t
> 2000/03/15 19:02:17 GMT
> >>> t.timeTime()
> 953146937.0
> >>> int( t.timeTime() )
> 953146936                  <<<<< This is wrong
> >>> int( 953146937.0 )
> 953146937
> 
> Any ideas on how this can be happening. Stepping through the DateTime module
> yields the sensible return value of 953146937.0 but somehow int() converts
> this incorrectly.

Simple: DateTime has been using floating-point calculations.  I believe
all of that has been corrected, however, with the new DateTime module,
available in the public CVS repository.

Shane