1 parent 23d7d84 commit 47f2fd1Copy full SHA for 47f2fd1
1 file changed
pythonosc/parsing/ntp.py
@@ -4,6 +4,8 @@
4
import struct
5
import time
6
7
+from typing import Union
8
+
9
# conversion factor for fractional seconds (maximum value of fractional part)
10
FRACTIONAL_CONVERSION = 2 ** 32
11
@@ -22,14 +24,14 @@ class NtpError(Exception):
22
24
"""Base class for ntp module errors."""
23
25
26
-def ntp_to_system_time(date):
27
+def ntp_to_system_time(date: Union[int, float]) -> Union[int, float]:
28
"""Convert a NTP time to system time.
29
30
System time is reprensented by seconds since the epoch in UTC.
31
"""
32
return date - _NTP_DELTA
33
-def system_time_to_ntp(date):
34
+def system_time_to_ntp(date: Union[int, float]) -> bytes:
35
"""Convert a system time to NTP time.
36
37
0 commit comments