]> granicus.if.org Git - python/commitdiff
Fix an odd error which would only occur close to new year's eve, due
authorGuido van Rossum <guido@python.org>
Tue, 1 Jan 2008 04:15:29 +0000 (04:15 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 1 Jan 2008 04:15:29 +0000 (04:15 +0000)
to use of datetime.datetime.now() instead of utcnow() for comparison.
(I think the test can still fail if it's executed pretty much *at*
new year's eve, but that's not worth fixing.)

Lib/sqlite3/test/types.py

index 506283da156006a71e94e9ed1c30be443cf4c23b..3cc9affc5dbac7d3efc56dffcc7df3fdb6ca36d4 100644 (file)
@@ -331,8 +331,7 @@ class DateTimeTests(unittest.TestCase):
         if sqlite.sqlite_version_info < (3, 1):
             return
 
-        # SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time.
-        now = datetime.datetime.now()
+        now = datetime.datetime.utcnow()
         self.cur.execute("insert into test(ts) values (current_timestamp)")
         self.cur.execute("select ts from test")
         ts = self.cur.fetchone()[0]