We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0ab8574 commit d244269Copy full SHA for d244269
aredis_om/model/encoders.py
@@ -50,14 +50,18 @@ def datetime_to_timestamp(t: datetime.datetime) -> int:
50
def time_to_timestamp(t: datetime.time) -> int:
51
# TODO: Find better / more correct approach!!!!!!!!!!!
52
offset = t.utcoffset()
53
- offset = math.floor(offset.total_seconds() * 1000) + offset.microseconds // 1000
+ offset_ms = (
54
+ math.floor(offset.total_seconds() * 1000) + offset.microseconds // 1000
55
+ if offset is not None
56
+ else 0
57
+ )
58
return (
59
t.hour * 3600 * 1000
60
+ t.minute * 60 * 1000
61
+ t.second * 1000
62
+ t.microsecond // 1000
63
- - offset
64
+ - offset_ms
65
)
66
67
0 commit comments