Skip to content

Commit

Permalink
Revert undesired change in vendor file
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSouchet committed Dec 13, 2024
1 parent 3c3188e commit 712e992
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@

import calendar
import collections.abc

from datetime import datetime, timezone, timedelta
import datetime

from google.protobuf.descriptor import FieldDescriptor

Expand Down Expand Up @@ -161,8 +160,8 @@ def FromJsonString(self, value):
raise ValueError(
'time data \'{0}\' does not match format \'%Y-%m-%dT%H:%M:%S\', '
'lowercase \'t\' is not accepted'.format(second_value))
date_object = datetime.strptime(second_value, _TIMESTAMPFOMAT)
td = date_object - datetime(1970, 1, 1)
date_object = datetime.datetime.strptime(second_value, _TIMESTAMPFOMAT)
td = date_object - datetime.datetime(1970, 1, 1)
seconds = td.seconds + td.days * _SECONDS_PER_DAY
if len(nano_value) > 9:
raise ValueError(
Expand Down Expand Up @@ -193,7 +192,7 @@ def FromJsonString(self, value):

def GetCurrentTime(self):
"""Get the current UTC into Timestamp."""
self.FromDatetime(datetime.now(timezone.utc))
self.FromDatetime(datetime.datetime.utcnow())

def ToNanoseconds(self):
"""Converts Timestamp to nanoseconds since epoch."""
Expand Down Expand Up @@ -245,7 +244,7 @@ def ToDatetime(self, tzinfo=None):
Otherwise, returns a timezone-aware datetime in the input timezone.
"""
delta = timedelta(
delta = datetime.timedelta(
seconds=self.seconds,
microseconds=_RoundTowardZero(self.nanos, _NANOS_PER_MICROSECOND))
if tzinfo is None:
Expand Down Expand Up @@ -383,7 +382,7 @@ def FromSeconds(self, seconds):

def ToTimedelta(self):
"""Converts Duration to timedelta."""
return timedelta(
return datetime.timedelta(
seconds=self.seconds, microseconds=_RoundTowardZero(
self.nanos, _NANOS_PER_MICROSECOND))

Expand Down

0 comments on commit 712e992

Please sign in to comment.