prune: compute pruning in utc timezone

guess this fixes issues like #5535.

i tested this with TZ=:
- UTC
- UTC+1 (my current local timezone)
- UTC+12
- UTC-12
- UTC+14
This commit is contained in:
Thomas Waldmann 2023-01-18 18:27:15 +01:00
parent 1df7c244c4
commit 860a48049b
No known key found for this signature in database
GPG Key ID: 243ACFA951F78E01
1 changed files with 4 additions and 2 deletions

View File

@ -53,8 +53,10 @@ def prune_split(archives, rule, n, kept_because=None):
a = None
for a in sorted(archives, key=attrgetter("ts"), reverse=True):
# we compute the pruning in local time zone
period = a.ts.astimezone().strftime(pattern)
# we compute the pruning in UTC time zone
# note: we used to compute the pruning in local timezone (tz=None),
# but this is causing test failures in some time zones (like e.g. UTC+12).
period = a.ts.astimezone(tz=timezone.utc).strftime(pattern)
if period != last:
last = period
if a.id not in kept_because: