Skip to content

Commit 38fbd43

Browse files
committed
fixup! Breaks out of pruning loop early if interval is passed
Can simply replace tzinfo with timezone.utc to create zoned datetime.min without underflow issues.
1 parent ab3d260 commit 38fbd43

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/borg/archiver/prune_cmd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import argparse
22
from collections import OrderedDict
3-
from datetime import datetime, timedelta
3+
from datetime import datetime, timezone
44
import logging
55
from operator import attrgetter
66
import os
@@ -102,7 +102,7 @@ def quarterly_3monthly_period_func(a):
102102

103103

104104
# Datetime cannot represent times before datetime.min, so a day is added to allow for time zone offset.
105-
DATETIME_MIN_WITH_ZONE = (datetime.min + timedelta(days=1)).astimezone()
105+
DATETIME_MIN_WITH_ZONE = datetime.min.replace(tzinfo=timezone.utc)
106106

107107

108108
def prune_split(archives, rule, n_or_interval, base_timestamp, kept_because=None):

0 commit comments

Comments
 (0)