Skip to content

Commit

Permalink
round to the nearest full microsecond (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
xs authored and agustinavarela committed Apr 12, 2017
1 parent 00f4739 commit 47d1ed9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tornado_mysql/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def convert_datetime(obj):
usecs = '0'
if '.' in hms:
hms, usecs = hms.split('.')
usecs = float('0.' + usecs) * 1e6
usecs = round(float('0.' + usecs) * 1e6)
return datetime.datetime(*[ int(x) for x in ymd.split('-')+hms.split(':')+[usecs] ])
except ValueError:
return convert_date(obj)
Expand Down

0 comments on commit 47d1ed9

Please sign in to comment.