feat(shared): create time functions

This commit is contained in:
jo 2022-02-18 22:01:48 +01:00 committed by Kyle Robbertze
parent 9d7d0ee6ca
commit 045fdc8d96
2 changed files with 29 additions and 0 deletions

View file

@ -0,0 +1,14 @@
from datetime import time
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