Skip to content

Commit d1fc512

Browse files
committed
fix time validity check
1 parent 9166399 commit d1fc512

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utility/time/TimeService.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ unsigned long TimeServiceClass::getRemoteTime()
320320

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

326328
bool TimeServiceClass::isTimeZoneOffsetValid(long const offset)

0 commit comments

Comments
 (0)