Permalink
Browse files

Preserve microseconds in stored datetime

  • Loading branch information...
stevearc committed Feb 23, 2015
1 parent e9af01b commit fffe92c21cf0941d0fd8dc7123fa939ba7891260
Showing with 4 additions and 1 deletion.
  1. +4 −1 flywheel/fields/types.py
@@ -443,7 +443,10 @@ def ddb_dump(self, value):
return Decimal("%d.%s" % (seconds, milliseconds))
def ddb_load(self, value):
return datetime.datetime.utcfromtimestamp(value).replace(tzinfo=UTC)
microseconds = 1000000 * (value - int(value))
return datetime.datetime.utcfromtimestamp(value) \
.replace(tzinfo=UTC) \
.replace(microsecond=microseconds)
register_type(DateTimeType)

0 comments on commit fffe92c

Please sign in to comment.