Replace deprecated datetime.datetime.utcnow()

datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version.

Co-authored-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
Change-Id: I0ab543277ced0b2d9c2b7ad4562e10835ca208bf
This commit is contained in:
Ivan Anfimov
2025-05-31 16:32:34 +00:00
parent 00aa57453a
commit 4f1821767e
2 changed files with 4 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ oslo.middleware>=3.31.0 # Apache-2.0
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
oslo.service!=1.28.1,>=1.24.0 # Apache-2.0
oslo.upgradecheck>=1.3.0 # Apache-2.0
oslo.utils>=3.40.0 # Apache-2.0
oslo.utils>=7.0.0 # Apache-2.0
oslo.concurrency>=3.26.0 # Apache-2.0
PyMySQL>=0.7.6 # MIT License
stevedore>=1.20.0 # Apache-2.0

View File

@@ -16,6 +16,7 @@
from datetime import datetime
from datetime import timedelta
from datetime import tzinfo
from oslo_utils import timeutils
class zulutime(tzinfo):
@@ -37,10 +38,10 @@ def utcnow_aware():
def utcnow():
"""A wrapper around datetime.datetime.utcnow(). We're doing this
"""A wrapper around timeutils.utcnow(). We're doing this
because it is mock'ed in some places.
"""
return datetime.utcnow()
return timeutils.utcnow()
def isotime(tm=None, subsecond=False):