]> granicus.if.org Git - python/commitdiff
Closes #14902: Fixed timezone conversion of a date/time in the past. Thanks to Yuriy...
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 3 Jul 2012 20:36:36 +0000 (21:36 +0100)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Tue, 3 Jul 2012 20:36:36 +0000 (21:36 +0100)
Lib/test/test_logging.py
Misc/ACKS

index 075b839b9502d68189cfcbecc4add5f2c48656ba..cb908fb4600b95ae8191fb64dfbbe2badff3c8f9 100644 (file)
@@ -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
index 06dd7ebd5cb628352fc2a7585f1cd0fb0d583a50..62d3e01cd3e3930876a78b40ee9a822148c81eb7 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -33,6 +33,7 @@ John Anderson
 Erik Andersén
 Oliver Andrich
 Ross Andrus
+Juancarlo Añez
 Jérémy Anger
 Jon Anglin
 Éric Araujo
@@ -1167,3 +1168,4 @@ Uwe Zessin
 Kai Zhu
 Tarek Ziadé
 Peter Åstrand
+