Skip to content

Commit fac98d7

Browse files
kytpbspennam
authored andcommitted
fix time validity check
1 parent 0383d65 commit fac98d7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utility/time/TimeService.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,9 @@ unsigned long TimeServiceClass::getRemoteTime()
322322

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

328330
bool TimeServiceClass::isTimeZoneOffsetValid(long const offset)

0 commit comments

Comments
 (0)