Use non-deprecated API for obtaining UTC time

DeprecationWarning: datetime.datetime.utcnow() is deprecated and
scheduled for removal in a future version. Use timezone-aware objects to
represent datetimes in UTC: datetime.datetime.now(datetime.UTC).

Change-Id: Ia2c46fb87c544d98cc2dd68a829f67d4770b479c
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/386615
Tested-by: Łukasz Patron <priv.luk@gmail.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Łukasz Patron <priv.luk@gmail.com>
Commit-Queue: Mike Frysinger <vapier@google.com>
This commit is contained in:
LuK1337
2023-09-16 09:36:49 +02:00
committed by LUCI
parent b8fd19215f
commit aadd12cb08
5 changed files with 13 additions and 9 deletions

4
repo
View File

@ -173,7 +173,7 @@ if not REPO_REV:
BUG_URL = "https://issues.gerritcodereview.com/issues/new?component=1370071"
# increment this whenever we make important changes to this script
VERSION = (2, 36)
VERSION = (2, 37)
# increment this if the MAINTAINER_KEYS block is modified
KEYRING_VERSION = (2, 3)
@ -838,7 +838,7 @@ def SetGitTrace2ParentSid(env=None):
KEY = "GIT_TRACE2_PARENT_SID"
now = datetime.datetime.utcnow()
now = datetime.datetime.now(datetime.timezone.utc)
value = "repo-%s-P%08x" % (now.strftime("%Y%m%dT%H%M%SZ"), os.getpid())
# If it's already set, then append ourselves.