Skip to content

Commit 685f2e9

Browse files
authored
Merge pull request #2914 from samestep/fix-epoch-naive-django5
Fix `graphite.util.epoch` for Django 5
2 parents b5d272b + a2fdc90 commit 685f2e9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

webapp/graphite/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def epoch(dt):
5959
if not dt.tzinfo:
6060
tb = traceback.extract_stack(None, 2)
6161
log.warning('epoch() called with non-timezone-aware datetime in %s at %s:%d' % (tb[0][2], tb[0][0], tb[0][1]))
62-
return calendar.timegm(make_aware(dt, pytz.timezone(settings.TIME_ZONE)).astimezone(pytz.utc).timetuple())
62+
return calendar.timegm(pytz.timezone(settings.TIME_ZONE).localize(dt, is_dst=None).astimezone(pytz.utc).timetuple())
6363
return calendar.timegm(dt.astimezone(pytz.utc).timetuple())
6464

6565

0 commit comments

Comments
 (0)