[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Appendix B: API Reference

webmaster@zope.org webmaster@zope.org
Wed, 25 Dec 2002 11:51:53 -0500


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/AppendixB.stx#2-40

---------------

    DateTime objects may be converted to integer, long, or float
    numbers of days since January 1, 1901, using the standard int, 
    long, and float functions (Compatibility Note: int, long and
    float return the number of days since 1901 in GMT rather than
    local machine timezone). DateTime objects also provide access
    to their value in a float format usable with the python time
    module, provided that the value of the object falls in the
    range of the epoch-based time module.

      % Anonymous User - June 10, 2002 10:51 am:
       It actually seems to return the time in seconds since 1/1/1970, not 1/1/1901.

      % Anonymous User - July 24, 2002 2:32 pm:
       I'm guessing that's a typo -- python has always run time from 1970

      % Anonymous User - Aug. 20, 2002 12:15 am:
       epoch

       [UNIX: prob. from astronomical timekeeping] n. The time and date corresponding to 0 in an operating system's
       clock and timestamp values. Under most UNIX versions the epoch is 00:00:00 GMT, January 1, 1970; under VMS,
       it's 00:00:00 of November 17, 1858 (base date of the U.S. Naval Observatory's ephemerides); on a Macintosh,
       it's the midnight beginning January 1 1904. System time is measured in seconds or ticks past the epoch. Weird
       problems may ensue when the clock wraps around (see wrap around), which is not necessarily a rare event; on
       systems counting 10 ticks per second, a signed 32-bit count of ticks is good only for 6.8 years. The
       1-tick-per-second clock of UNIX is good only until January 18, 2038, assuming at least some software
       continues to consider it signed and that word lengths don't increase by then.

      % jmunoz - Nov. 14, 2002 10:57 am:
       I confirm, it's the numbers of seconds, and not days, as said here.

       Correct this in the next release of the Zope Book, please !!

      % Anonymous User - Nov. 28, 2002 5:19 am:
       ...but when I run

       return str(DateTime()+1)

       ... it returns the date of tomorrow, not one second later from now!!... it seems DateTime REALLY returns
       'days' not seconds
       Run for Zope 2.60 (Python 2.1.3)

      % Anonymous User - Dec. 25, 2002 11:51 am:
       Yes, but this is another issue.
       Julian