From 5b28fe03ed1294941228675a9531f02defdf75ed Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Tue, 20 Jul 2021 13:24:16 +0200 Subject: [PATCH] fix for negative time diffs --- include/timesync.h | 4 ++-- src/timesync.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/timesync.h b/include/timesync.h index 3190ce64..241c5354 100644 --- a/include/timesync.h +++ b/include/timesync.h @@ -9,8 +9,8 @@ #define TIME_SYNC_FIXUP 16 // compensation for processing time [milliseconds] #define TIME_SYNC_MAX_SEQNO 0xfe // threshold for wrap around time_sync_seqNo #define TIME_SYNC_END_FLAG (TIME_SYNC_MAX_SEQNO + 1) // end of handshake marker -#define GPS_UTC_DIFF 315964800 // seconds diff between gps and utc epoch -#define LEAP_SECS_SINCE_GPSEPOCH 18 // state of 2021 +#define GPS_UTC_DIFF 315964800UL // seconds diff between gps and utc epoch +#define LEAP_SECS_SINCE_GPSEPOCH 18UL // state of 2021 enum timesync_t { timesync_tx, diff --git a/src/timesync.cpp b/src/timesync.cpp index 121c34a4..2a25d4d0 100644 --- a/src/timesync.cpp +++ b/src/timesync.cpp @@ -230,7 +230,7 @@ void IRAM_ATTR timesync_serverAnswer(void *pUserData, int flag) { // pUserData: contains pointer to SeqNo (not needed here) // flag: indicates if we got a recent time from the network - uint32_t delay_msec; + int32_t delay_msec; lmic_time_reference_t lmicTime; if (flag != 1) {