From 78e9ec7edc96c07e0f11ccaecafd11c536248eff Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Thu, 8 Aug 2024 23:54:06 -0500 Subject: [PATCH] Adds MESHTASTIC_EXCLUDE_TZ option --- src/configuration.h | 3 ++- src/gps/RTC.cpp | 4 ++++ src/main.cpp | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/configuration.h b/src/configuration.h index 5365db2391..9148f1d377 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -257,6 +257,7 @@ along with this program. If not, see . #define MESHTASTIC_EXCLUDE_POWERMON 1 #define MESHTASTIC_EXCLUDE_I2C 1 #define MESHTASTIC_EXCLUDE_POWER_FSM 1 +#define MESHTASTIC_EXCLUDE_TZ 1 #endif // Turn off all optional modules @@ -312,4 +313,4 @@ along with this program. If not, see . #endif #include "DebugConfiguration.h" -#include "RF95Configuration.h" +#include "RF95Configuration.h" \ No newline at end of file diff --git a/src/gps/RTC.cpp b/src/gps/RTC.cpp index d60e3825c8..710baca985 100644 --- a/src/gps/RTC.cpp +++ b/src/gps/RTC.cpp @@ -256,6 +256,7 @@ uint32_t getValidTime(RTCQuality minQuality, bool local) time_t gm_mktime(struct tm *tm) { +#if !MESHTASTIC_EXCLUDE_TZ setenv("TZ", "GMT0", 1); time_t res = mktime(tm); if (*config.device.tzdef) { @@ -264,4 +265,7 @@ time_t gm_mktime(struct tm *tm) setenv("TZ", "UTC0", 1); } return res; +#else + return mktime(tm); +#endif } \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index f4f7ad537d..0a3c1ae0b5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -689,6 +689,7 @@ void setup() screen = new graphics::Screen(screen_found, screen_model, screen_geometry); // setup TZ prior to time actions. +#if !MESHTASTIC_EXCLUDE_TZ if (*config.device.tzdef) { setenv("TZ", config.device.tzdef, 1); } else { @@ -696,6 +697,7 @@ void setup() } tzset(); LOG_DEBUG("Set Timezone to %s\n", getenv("TZ")); +#endif readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time)