File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -864,9 +864,9 @@ async def _clock_synchronize_scheduler(self) -> None:
864864 try :
865865 await self .clock_synchronize ()
866866 except Exception :
867- _LOGGER .exception ("Clock synchronisation failed for %s" , self .name )
867+ _LOGGER .exception ("Clock synchronisation failed for %s" , self .mac_in_str )
868868 except CancelledError :
869- _LOGGER .debug ("Clock sync scheduler cancelled for %s" , self .name )
869+ _LOGGER .debug ("Clock sync scheduler cancelled for %s" , self .mac_in_str )
870870 raise
871871
872872 async def clock_synchronize (self ) -> bool :
@@ -883,9 +883,7 @@ async def clock_synchronize(self) -> bool:
883883 tzinfo = UTC ,
884884 )
885885 clock_offset = clock_response .timestamp .replace (microsecond = 0 ) - _dt_of_circle
886- if (clock_offset .seconds < MAX_TIME_DRIFT ) or (
887- clock_offset .seconds > - (MAX_TIME_DRIFT )
888- ):
886+ if abs (clock_offset .total_seconds ()) < MAX_TIME_DRIFT :
889887 return True
890888 _LOGGER .info (
891889 "Reset clock of node %s because time has drifted %s sec" ,
Original file line number Diff line number Diff line change @@ -86,9 +86,7 @@ async def clock_synchronize(self) -> bool:
8686 tzinfo = UTC ,
8787 )
8888 clock_offset = clock_response .timestamp .replace (microsecond = 0 ) - _dt_of_circle
89- if (clock_offset .seconds < MAX_TIME_DRIFT ) or (
90- clock_offset .seconds > - (MAX_TIME_DRIFT )
91- ):
89+ if abs (clock_offset .total_seconds ()) < MAX_TIME_DRIFT :
9290 return True
9391 _LOGGER .info (
9492 "Reset realtime clock of node %s because time has drifted %s seconds while max drift is set to %s seconds)" ,
You can’t perform that action at this time.
0 commit comments