ANN: Python module for dealing with timezones

Tom Satter tsatter at purecode.com
Thu Aug 9 23:43:47 EDT 2001


I have written a script to allow timezone information to be
used within Python.  The script can be found at:

http://www.purecode.com/~tsatter/python/

The zi2py script takes timezone information given in the format
specified by the timezone info files that can be found at:

ftp://elsie.nci.nih.gov/pub/tzdata*.tar.gz

The program then writes out a file called zoneinfo.py
which may be imported to allow timezone information to
be used in a python program.

Available functions:

allZoneNames()
    Returns a list of all of the supported timezone names.

localZoneNames(name)
    Returns a two-tuple.  The first value is a list of the names
    immediately below the given name that are directories.  The
    second value is a list of the names immediately below the given
    name that are zone names.  Returns two empty lists if the
    given name is a zone name.  Returns None if the name given is
    not a zone name or a zone directory.

getZone(name)
    Returns a zone data structure given the timezone name.

zonetime(zone, secs)
    Convert a time expressed in seconds since the epoch to a time tuple
    for the given zone.  The zone should be a zone data structure
    returned by the getZone function.  The time will be converted with
    the correct daylight savings time for the given zone and time.
    Fractions of a second are ignored.  See the time module for a
    description of the tuple lay-out.

--
tom -- just plain old tom
tsatter at purecode.com





More information about the Python-list mailing list