summaryrefslogtreecommitdiff
path: root/msgpack/ext.py
diff options
context:
space:
mode:
authorTom Pohl <thomas.pohl@gmail.com>2020-07-23 10:53:55 +0200
committerGitHub <noreply@github.com>2020-07-23 17:53:55 +0900
commit5614dd5a898772faa2dfe89bd9f6a5c90c5fafe5 (patch)
treeec132891ecc8e3e09521483b9c434d669099f116 /msgpack/ext.py
parentd9ead81021c7b5f034a0475bf9a88e9612cc8e84 (diff)
downloadmsgpack-python-5614dd5a898772faa2dfe89bd9f6a5c90c5fafe5.tar.gz
Allow for timestamps before UNIX epoch (#433)
Diffstat (limited to 'msgpack/ext.py')
-rw-r--r--msgpack/ext.py4
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):