Skip to content

Commit 01b154c

Browse files
Update GetCurrentTime to use datetime.datetime.now
`datetime.datetime.utcnow` is apparently deprecated. The suggested fix is to use timezone-aware objects. PiperOrigin-RevId: 748738057
1 parent f494a97 commit 01b154c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/google/protobuf/internal/well_known_types.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def FromJsonString(self, value):
181181

182182
def GetCurrentTime(self):
183183
"""Get the current UTC into Timestamp."""
184-
self.FromDatetime(datetime.datetime.utcnow())
184+
self.FromDatetime(datetime.datetime.now(tz=datetime.timezone.utc))
185185

186186
def ToNanoseconds(self):
187187
"""Converts Timestamp to nanoseconds since epoch."""

0 commit comments

Comments
 (0)