diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index e1479e01be0..24b9d92cf14 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -2,6 +2,7 @@ from __future__ import annotations +import calendar import contextlib import json import re @@ -491,7 +492,7 @@ def limit_rate(self, response_url: str, retry_after: str) -> float | None: parsed = parsedate_tz(retry_after) assert parsed is not None # the 10th element is the GMT offset in seconds - next_check = time.mktime(parsed[:9]) - (parsed[9] or 0) + next_check = float(calendar.timegm(parsed[:9])) - (parsed[9] or 0) except (AssertionError, TypeError, ValueError): # TypeError: Invalid date format. # ValueError: Invalid date, e.g. Oct 52th.