Merge pull request #1890 from pbiering/fix-1851-1888
Fix: out-of-range timestamp on 32-bit systems
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## 3.5.8.dev
|
## 3.5.8.dev
|
||||||
* Extend [auth]: re-factor & overhaul LDPA autrhentication, especially for Python's ldap module
|
* Extend [auth]: re-factor & overhaul LDPA autrhentication, especially for Python's ldap module
|
||||||
|
* Fix: out-of-range timestamp on 32-bit systems
|
||||||
|
|
||||||
## 3.5.7
|
## 3.5.7
|
||||||
* Extend: [auth] dovecot: add support for version >= 2.4
|
* Extend: [auth] dovecot: add support for version >= 2.4
|
||||||
|
|||||||
@@ -280,10 +280,7 @@ def format_ut(unixtime: int) -> str:
|
|||||||
# TODO check how to support this better
|
# TODO check how to support this better
|
||||||
return str(unixtime)
|
return str(unixtime)
|
||||||
if unixtime < DATETIME_MAX_UNIXTIME:
|
if unixtime < DATETIME_MAX_UNIXTIME:
|
||||||
if sys.version_info < (3, 11):
|
dt = datetime.datetime(1970, 1, 1, tzinfo=datetime.timezone.utc) + datetime.timedelta(seconds=unixtime)
|
||||||
dt = datetime.datetime.utcfromtimestamp(unixtime)
|
|
||||||
else:
|
|
||||||
dt = datetime.datetime.fromtimestamp(unixtime, datetime.UTC)
|
|
||||||
r = str(unixtime) + "(" + dt.strftime('%Y-%m-%dT%H:%M:%SZ') + ")"
|
r = str(unixtime) + "(" + dt.strftime('%Y-%m-%dT%H:%M:%SZ') + ")"
|
||||||
else:
|
else:
|
||||||
r = str(unixtime) + "(>MAX:" + str(DATETIME_MAX_UNIXTIME) + ")"
|
r = str(unixtime) + "(>MAX:" + str(DATETIME_MAX_UNIXTIME) + ")"
|
||||||
|
|||||||
Reference in New Issue
Block a user