Skip to content

Commit 47f2fd1

Browse files
committed
Add type annotation
1 parent 23d7d84 commit 47f2fd1

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pythonosc/parsing/ntp.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import struct
55
import time
66

7+
from typing import Union
8+
79
# conversion factor for fractional seconds (maximum value of fractional part)
810
FRACTIONAL_CONVERSION = 2 ** 32
911

@@ -22,14 +24,14 @@ class NtpError(Exception):
2224
"""Base class for ntp module errors."""
2325

2426

25-
def ntp_to_system_time(date):
27+
def ntp_to_system_time(date: Union[int, float]) -> Union[int, float]:
2628
"""Convert a NTP time to system time.
2729
2830
System time is reprensented by seconds since the epoch in UTC.
2931
"""
3032
return date - _NTP_DELTA
3133

32-
def system_time_to_ntp(date):
34+
def system_time_to_ntp(date: Union[int, float]) -> bytes:
3335
"""Convert a system time to NTP time.
3436
3537
System time is reprensented by seconds since the epoch in UTC.

0 commit comments

Comments
 (0)