Refine Timestamp APIs (#395)

This commit is contained in:
Inada Naoki 2019-12-12 19:43:59 +09:00 committed by GitHub
parent aab29ff277
commit 887d3a7d22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 50 deletions

View file

@ -691,9 +691,9 @@ class Unpacker(object):
if n == -1: # timestamp
ts = Timestamp.from_bytes(bytes(obj))
if self._timestamp == 1:
return ts.to_float()
return ts.to_unix()
elif self._timestamp == 2:
return ts.to_unix_ns()
return ts.to_unix_nano()
elif self._timestamp == 3:
return ts.to_datetime()
else: