diff options
Diffstat (limited to 'glucometerutils/support/construct_extras.py')
-rw-r--r-- | glucometerutils/support/construct_extras.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/glucometerutils/support/construct_extras.py b/glucometerutils/support/construct_extras.py index b44ee84..4ed8a7a 100644 --- a/glucometerutils/support/construct_extras.py +++ b/glucometerutils/support/construct_extras.py @@ -18,15 +18,15 @@ class Timestamp(construct.Adapter): __slots__ = ["epoch"] - def __init__(self, subcon, epoch=0): + def __init__(self, subcon, epoch: int = 0) -> None: super(Timestamp, self).__init__(subcon) self.epoch = epoch - def _encode(self, obj, context, path): + def _encode(self, obj: datetime.datetime, context, path) -> int: assert isinstance(obj, datetime.datetime) epoch_date = datetime.datetime.utcfromtimestamp(self.epoch) delta = obj - epoch_date return int(delta.total_seconds()) - def _decode(self, obj, context, path): + def _decode(self, obj: int, context, path) -> datetime.datetime: return datetime.datetime.utcfromtimestamp(obj + self.epoch) |