Skip to content

Commit 6b50f2d

Browse files
authored
Merge pull request #1987 from pbiering/fix-1984
fix issue#1984 (refix issue#1851)
2 parents cfb55b5 + 1b93b9e commit 6b50f2d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Improve: add workaround to remove empty lines in item to avoid reject by vobject parser
77
* Improve: check/enforce RECURRENCE-ID MUST have the same value type as DTSTART in the recurring component (RFC 5545 3.8.4.4)
88
* Fix: RECURRENCE-ID comparison on all-day events
9+
* Fix: format_ut problem on 32-bit systems (got lost inbetween since fixed in 3.5.8)
910

1011
## 3.6.0
1112

radicale/utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,13 @@ def format_ut(unixtime: int) -> str:
338338
elif unixtime >= DATETIME_MAX_UNIXTIME:
339339
r = str(unixtime) + "(>=MAX:" + str(DATETIME_MAX_UNIXTIME) + ")"
340340
else:
341-
if sys.version_info < (3, 11):
342-
dt = datetime.datetime.utcfromtimestamp(unixtime)
341+
if sys.maxsize > 2**32:
342+
if sys.version_info < (3, 11):
343+
dt = datetime.datetime.utcfromtimestamp(unixtime)
344+
else:
345+
dt = datetime.datetime.fromtimestamp(unixtime, datetime.UTC)
343346
else:
344-
dt = datetime.datetime.fromtimestamp(unixtime, datetime.UTC)
347+
dt = datetime.datetime(1970, 1, 1, tzinfo=datetime.timezone.utc) + datetime.timedelta(seconds=unixtime)
345348
r = str(unixtime) + "(" + dt.strftime('%Y-%m-%dT%H:%M:%SZ') + ")"
346349
return r
347350

0 commit comments

Comments
 (0)