mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-24 22:02:30 +00:00
Stop past timestamps from setting our system time RTC (#4704)
* Ignore attempts to set times in the past (before our build epoch) * TRONK
This commit is contained in:
parent
b59bd6fee9
commit
35cfe4318a
@ -81,6 +81,7 @@ build_flags = -Wno-missing-field-initializers
|
|||||||
-DRADIOLIB_EXCLUDE_APRS
|
-DRADIOLIB_EXCLUDE_APRS
|
||||||
-DRADIOLIB_EXCLUDE_LORAWAN
|
-DRADIOLIB_EXCLUDE_LORAWAN
|
||||||
-DMESHTASTIC_EXCLUDE_DROPZONE=1
|
-DMESHTASTIC_EXCLUDE_DROPZONE=1
|
||||||
|
-DBUILD_EPOCH=$UNIX_TIME
|
||||||
;-D OLED_PL
|
;-D OLED_PL
|
||||||
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
@ -109,6 +109,12 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpdate)
|
|||||||
static uint32_t lastSetMsec = 0;
|
static uint32_t lastSetMsec = 0;
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
uint32_t printableEpoch = tv->tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
uint32_t printableEpoch = tv->tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
||||||
|
#ifdef BUILD_EPOCH
|
||||||
|
if (tv->tv_sec < BUILD_EPOCH) {
|
||||||
|
LOG_WARN("Ignoring time (%ld) before build epoch (%ld)!\n", printableEpoch, BUILD_EPOCH);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool shouldSet;
|
bool shouldSet;
|
||||||
if (forceUpdate) {
|
if (forceUpdate) {
|
||||||
|
Loading…
Reference in New Issue
Block a user