Skip to content

Commit 6d236a7

Browse files
author
guido.van.rossum
committed
Fix an odd error which would only occur close to new year's eve, due
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.) git-svn-id: http://svn.python.org/projects/python/trunk@59637 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 0dac4eb commit 6d236a7

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Lib/sqlite3/test/types.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ def CheckSqlTimestamp(self):
331331
if sqlite.sqlite_version_info < (3, 1):
332332
return
333333

334-
# SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time.
335-
now = datetime.datetime.now()
334+
now = datetime.datetime.utcnow()
336335
self.cur.execute("insert into test(ts) values (current_timestamp)")
337336
self.cur.execute("select ts from test")
338337
ts = self.cur.fetchone()[0]

0 commit comments

Comments
 (0)