~ubuntu-branches/ubuntu/quantal/python-tz/quantal

« back to all changes in this revision

Viewing changes to pytz/tzinfo.py

  • Committer: Bazaar Package Importer
  • Author(s): Brian Sutherland
  • Date: 2007-05-09 12:01:36 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070509120136-oi18syaota63tyzy
Tags: 2007d-1
* New upstream release (Closes: 415458)
* Revert patch ignoring arch files, it's not necessary any and conflicted
  with upstream.
* Patch upstream to use /usr/share/zoneinfo and remove the included version,
  also depend on tzdata package. (Closes: 416202)
* Write and install a testrunner that can run the pytz tests in
  /usr/lib/python-tz/test-pytxX.Y which tests pythonX.Y.
* Build depends on python-central > 0.5, debhelper > 5.0.38
* Remove workaround for python-central/debhelper breakage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
        _timedelta_cache[seconds] = delta
19
19
        return delta
20
20
 
21
 
_datetime_cache = {}
 
21
_epoch = datetime.utcfromtimestamp(0)
 
22
_datetime_cache = {0: _epoch}
22
23
def memorized_datetime(seconds):
23
24
    '''Create only one instance of each distinct datetime'''
24
25
    try:
25
26
        return _datetime_cache[seconds]
26
27
    except KeyError:
27
 
        dt = datetime.utcfromtimestamp(seconds)
 
28
        # NB. We can't just do datetime.utcfromtimestamp(seconds) as this
 
29
        # fails with negative values under Windows (Bug #90096)
 
30
        dt = _epoch + timedelta(seconds=seconds)
28
31
        _datetime_cache[seconds] = dt
29
32
        return dt
30
33