We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1ce7dd3 commit 8bc388bCopy full SHA for 8bc388b
ydb/types.py
@@ -23,6 +23,7 @@
23
24
_SECONDS_IN_DAY = 60 * 60 * 24
25
_EPOCH = datetime(1970, 1, 1)
26
+_EPOCH_UTC = datetime(1970, 1, 1, tzinfo=timezone.utc)
27
28
29
def _from_date(x: ydb_value_pb2.Value, table_client_settings: table.TableClientSettings) -> typing.Union[date, int]:
@@ -91,7 +92,7 @@ def _from_timestamp(
91
92
def _to_timestamp(pb: ydb_value_pb2.Value, value: typing.Union[datetime, int]):
93
if isinstance(value, datetime):
94
if value.tzinfo:
- epoch = _EPOCH.replace(tzinfo=timezone.utc)
95
+ epoch = _EPOCH_UTC
96
else:
97
epoch = _EPOCH
98
pb.uint64_value = _timedelta_to_microseconds(value - epoch)
0 commit comments