8000 Allow for timestamps before UNIX epoch (#433) · tsahee/msgpack-python@5614dd5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5614dd5

Browse files
authored
Allow for timestamps before UNIX epoch (msgpack#433)
1 parent d9ead81 commit 5614dd5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

msgpack/ext.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ def to_datetime(self):
178178
179179
:rtype: datetime.
180180
"""
181-
return datetime.datetime.fromtimestamp(self.to_unix(), _utc)
181+
return datetime.datetime.fromtimestamp(0, _utc) + datetime.timedelta(
182+
seconds=self.to_unix()
183+
)
182184

183185
@staticmethod
184186
def from_datetime(dt):

0 commit comments

Comments
 (0)
0