Skip to content

Commit 8bc388b

Browse files
committed
Optimize
1 parent 1ce7dd3 commit 8bc388b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ydb/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
_SECONDS_IN_DAY = 60 * 60 * 24
2525
_EPOCH = datetime(1970, 1, 1)
26+
_EPOCH_UTC = datetime(1970, 1, 1, tzinfo=timezone.utc)
2627

2728

2829
def _from_date(x: ydb_value_pb2.Value, table_client_settings: table.TableClientSettings) -> typing.Union[date, int]:
@@ -91,7 +92,7 @@ def _from_timestamp(
9192
def _to_timestamp(pb: ydb_value_pb2.Value, value: typing.Union[datetime, int]):
9293
if isinstance(value, datetime):
9394
if value.tzinfo:
94-
epoch = _EPOCH.replace(tzinfo=timezone.utc)
95+
epoch = _EPOCH_UTC
9596
else:
9697
epoch = _EPOCH
9798
pb.uint64_value = _timedelta_to_microseconds(value - epoch)

0 commit comments

Comments
 (0)