diff --git a/asyncpool/__init__.py b/asyncpool/__init__.py index 8898b4a..2c6dbd4 100644 --- a/asyncpool/__init__.py +++ b/asyncpool/__init__.py @@ -2,8 +2,7 @@ from datetime import datetime, timezone def utc_now(): - # utcnow returns a naive datetime, so we have to set the timezone manually - return datetime.utcnow().replace(tzinfo=timezone.utc) + return datetime.now(tz=timezone.utc) class Terminator: pass @@ -151,4 +150,4 @@ async def join(self): self._logger.debug('Completed {}'.format(self._name)) if self._exceptions and self._raise_on_join: - raise Exception("Exception occurred in pool {}".format(self._name)) \ No newline at end of file + raise Exception("Exception occurred in pool {}".format(self._name))