Skip to content

Fix time validity check to account for maximum possible timezone offset #507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading