From 155a11104cc6591cd97305acd61aed7b5fc07f4e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 15 Feb 2018 15:26:20 +1000 Subject: [PATCH] wacom: print an error if our device is more than 5 mins out --- tuhi/wacom.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tuhi/wacom.py b/tuhi/wacom.py index 4098f1e..da6f32a 100644 --- a/tuhi/wacom.py +++ b/tuhi/wacom.py @@ -408,7 +408,10 @@ class WacomProtocolBase(WacomProtocolLowLevelComm): expected_opcode=0xbd) ts = self.time_from_bytes(data) logger.debug(f'b6 returned time: UTC {time.strftime("%y%m%d%H%M%S", ts)}') - # FIXME: check if data matches self.current_time + + tdelta = time.mktime(time.gmtime()) - time.mktime(ts) + if abs(tdelta) > 300: + logger.error(f'device time is out by more than 5 minutes') def get_battery_info(self): data = self.send_nordic_command_sync(command=0xb9,