diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-07-03 20:36:36 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-07-03 20:36:36 (GMT) |
commit | ed1f7c834fb38481fde3f8a317a48c8fe43d0809 (patch) | |
tree | dabe3695f8fcbc5c070361b160d86bce12f4b5fa /Lib/test/test_logging.py | |
parent | 5da6039765bce8f36c0e598f65a28013d6734006 (diff) | |
download | cpython-ed1f7c834fb38481fde3f8a317a48c8fe43d0809.zip cpython-ed1f7c834fb38481fde3f8a317a48c8fe43d0809.tar.gz cpython-ed1f7c834fb38481fde3f8a317a48c8fe43d0809.tar.bz2 |
Closes #14902: Fixed timezone conversion of a date/time in the past. Thanks to Yuriy Syrovetskiy for the report and Juancarlo AƱez for the patch on which this fix is based.
Diffstat (limited to 'Lib/test/test_logging.py')
-rw-r--r-- | Lib/test/test_logging.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 075b839..cb908fb 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -2899,8 +2899,10 @@ class FormatterTest(unittest.TestCase): def test_time(self): r = self.get_record() - dt = datetime.datetime(1993,4,21,8,3,0,0,utc) - r.created = time.mktime(dt.timetuple()) - time.timezone + dt = datetime.datetime(1993, 4, 21, 8, 3, 0, 0, utc) + # We use None to indicate we want the local timezone + # We're essentially converting a UTC time to local time + r.created = time.mktime(dt.astimezone(None).timetuple()) r.msecs = 123 f = logging.Formatter('%(asctime)s %(message)s') f.converter = time.gmtime |