Work around -Wsign-compare

Using difftime() might be more clean, but uses doubles instead of
integers.
This commit is contained in:
Reto Schneider 2023-03-27 01:08:44 +02:00
parent 893f814d53
commit f2ff386d0e

View File

@ -746,7 +746,7 @@ void observe_step(lwm2m_context_t * contextP,
{
LOG_ARG("Checking minimal period (%d s)", watcherP->parameters->minPeriod);
if (watcherP->lastTime + watcherP->parameters->minPeriod > currentTime)
if ((time_t)(watcherP->lastTime + watcherP->parameters->minPeriod) > currentTime)
{
// Minimum Period did not elapse yet
interval = watcherP->lastTime + watcherP->parameters->minPeriod - currentTime;
@ -768,7 +768,7 @@ void observe_step(lwm2m_context_t * contextP,
{
LOG_ARG("Checking maximal period (%d s)", watcherP->parameters->maxPeriod);
if (watcherP->lastTime + watcherP->parameters->maxPeriod <= currentTime)
if ((time_t)(watcherP->lastTime + watcherP->parameters->maxPeriod) <= currentTime)
{
LOG("Notify on maximal period");
notify = true;