summaryrefslogtreecommitdiff
path: root/kombu/asynchronous/timer.py
diff options
context:
space:
mode:
Diffstat (limited to 'kombu/asynchronous/timer.py')
-rw-r--r--kombu/asynchronous/timer.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/kombu/asynchronous/timer.py b/kombu/asynchronous/timer.py
index f6be1346..ab0291da 100644
--- a/kombu/asynchronous/timer.py
+++ b/kombu/asynchronous/timer.py
@@ -16,10 +16,10 @@ from vine.utils import wraps
from kombu.log import get_logger
-try:
- from pytz import utc
-except ImportError: # pragma: no cover
- utc = None
+if sys.version_info >= (3, 9):
+ from zoneinfo import ZoneInfo
+else:
+ from backports.zoneinfo import ZoneInfo
if TYPE_CHECKING:
from types import TracebackType
@@ -29,13 +29,13 @@ __all__ = ('Entry', 'Timer', 'to_timestamp')
logger = get_logger(__name__)
DEFAULT_MAX_INTERVAL = 2
-EPOCH = datetime.utcfromtimestamp(0).replace(tzinfo=utc)
+EPOCH = datetime.utcfromtimestamp(0).replace(tzinfo=ZoneInfo("UTC"))
IS_PYPY = hasattr(sys, 'pypy_version_info')
scheduled = namedtuple('scheduled', ('eta', 'priority', 'entry'))
-def to_timestamp(d, default_timezone=utc, time=monotonic):
+def to_timestamp(d, default_timezone=ZoneInfo("UTC"), time=monotonic):
"""Convert datetime to timestamp.
If d' is already a timestamp, then that will be used.