diff options
author | Tom Pohl <thomas.pohl@gmail.com> | 2020-07-23 10:53:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-23 17:53:55 +0900 |
commit | 5614dd5a898772faa2dfe89bd9f6a5c90c5fafe5 (patch) | |
tree | ec132891ecc8e3e09521483b9c434d669099f116 /msgpack/ext.py | |
parent | d9ead81021c7b5f034a0475bf9a88e9612cc8e84 (diff) | |
download | msgpack-python-5614dd5a898772faa2dfe89bd9f6a5c90c5fafe5.tar.gz |
Allow for timestamps before UNIX epoch (#433)
Diffstat (limited to 'msgpack/ext.py')
-rw-r--r-- | msgpack/ext.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/msgpack/ext.py b/msgpack/ext.py index 8341c68..4eb9dd6 100644 --- a/msgpack/ext.py +++ b/msgpack/ext.py @@ -178,7 +178,9 @@ class Timestamp(object): :rtype: datetime. """ - return datetime.datetime.fromtimestamp(self.to_unix(), _utc) + return datetime.datetime.fromtimestamp(0, _utc) + datetime.timedelta( + seconds=self.to_unix() + ) @staticmethod def from_datetime(dt): |