Skip to content

Commit

Permalink
fix time validity check
Browse files Browse the repository at this point in the history
  • Loading branch information
kytpbs committed Aug 23, 2024
1 parent 9166399 commit d1fc512
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utility/time/TimeService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,9 @@ unsigned long TimeServiceClass::getRemoteTime()

bool TimeServiceClass::isTimeValid(unsigned long const time)
{
return (time > EPOCH_AT_COMPILE_TIME);
// EPOCH_AT_COMPILE_TIME is in local time,
// so we need to subtract the maximum possible timezone offset to make sure we are less then utc time
return (time > (EPOCH_AT_COMPILE_TIME - (/*UTC+14*/ 14 * 60 * 60)));
}

bool TimeServiceClass::isTimeZoneOffsetValid(long const offset)
Expand Down

0 comments on commit d1fc512

Please sign in to comment.