Closed
Description
If the user's timezone is higher than UTC (ex. UTC+4) than if the code is compiled at 22.00 UTC
, EPOCH_AT_COMPILE_TIME
will return a value higher than the current epoch because cvt_time(__DATE__)
returns the date according to the user's local timezone.
This means that code compiled at 23.00 UTC
will not function for timezones UTC+1
and higher.
according to wiki the biggest offset is UTC+14
so decreasing 50400
(14 * 60 * 60) would work:
ArduinoIoTCloud/src/utility/time/TimeService.cpp line 97
#define EPOCH_AT_COMPILE_TIME (cvt_time(__DATE__) - 50400)
or
ArduinoIoTCloud/src/utility/time/TimeService.cpp line 323
bool TimeServiceClass::isTimeValid(unsigned long const time)
{
return (time > (EPOCH_AT_COMPILE_TIME - 50400));
}
This may not be the best solution but is one nevertheless.
I can open a simple PR for this if it is ok for you guys.