[Zope-dev] DateTime Error?

Lindell Alderman lindell@atlantis.otak.com
Tue, 21 Mar 2000 15:18:06 -0800


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