Skip to content

Commit 47d1ed9

Browse files
xsagustinavarela
authored andcommitted
round to the nearest full microsecond (#2)
1 parent 00f4739 commit 47d1ed9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tornado_mysql/converters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def convert_datetime(obj):
123123
usecs = '0'
124124
if '.' in hms:
125125
hms, usecs = hms.split('.')
126-
usecs = float('0.' + usecs) * 1e6
126+
usecs = round(float('0.' + usecs) * 1e6)
127127
return datetime.datetime(*[ int(x) for x in ymd.split('-')+hms.split(':')+[usecs] ])
128128
except ValueError:
129129
return convert_date(obj)

0 commit comments

Comments
 (0)