feat(shared): create time functions
This commit is contained in:
parent
9d7d0ee6ca
commit
045fdc8d96
2 changed files with 29 additions and 0 deletions
14
shared/libretime_shared/datetime.py
Normal file
14
shared/libretime_shared/datetime.py
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue