[Zope-dev] DateTime Error?

Jonothan Farr jfarr@real.com
Tue, 21 Mar 2000 15:28:56 -0800


This is definitely a problem. The common explanation is floating point errors.

-jfarr

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hi! I'm a signature virus.
Copy me into your .sig to join the fun!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message ----- 
From: Lindell Alderman <lindell@atlantis.otak.com>
To: <lindell@atlantis.otak.com>
Cc: <zope-dev@zope.org>
Sent: Tuesday, March 21, 2000 3:18 PM
Subject: [Zope-dev] DateTime Error?


> I think I have found an inconsistency in the Zope DateTime class.
> The following piece of code illustrates it.
> 
> #!/usr/bin/python
> import DateTime
> now = DateTime.DateTime()
> 
> for x in range(0,24):
>   dt = DateTime.DateTime('%04d-%02d-%02d %02d:30:00' % (now.year(),
>                                                         now.month(),
>                                                         now.day(),x))
>   print dt.parts()
> 
> # end of code
> 
> Here is the output on my Debian Linux box.
> 
> (2000, 3, 21, 0, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 1, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 2, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 3, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 4, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 5, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 6, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 7, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 8, 29, 60.0, 'US/Pacific')
> (2000, 3, 21, 9, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 10, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 11, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 12, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 13, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 14, 30, 7.27595761418e-12, 'US/Pacific')
> (2000, 3, 21, 15, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 16, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 17, 30, 7.27595761418e-12, 'US/Pacific')
> (2000, 3, 21, 18, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 19, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 20, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 21, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 22, 30, 0.0, 'US/Pacific')
> (2000, 3, 21, 23, 30, 0.0, 'US/Pacific')
> 
> Notice that at 8:30 am the DateTime class prints 8:29:60
> instead of 8:30:00.  Then notice at 2:30 and 5:30 the number
> of seconds is slight off too.  I have not found the cause yet.
> Has anyone noticed this problem too?
> 
> Norman Alderman
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>