libretime/shared/libretime_shared/datetime.py

15 lines
301 B
Python
Raw Permalink Normal View History

2022-10-10 18:39:40 +02:00
from datetime import time
2022-02-18 22:01:48 +01:00
def time_in_seconds(value: time) -> float:
return (
value.hour * 60 * 60
+ value.minute * 60
+ value.second
+ value.microsecond / 1000000.0
)
def time_in_milliseconds(value: time) -> float:
return time_in_seconds(value) * 1000