Adds MESHTASTIC_EXCLUDE_TZ option (#4423)

This commit is contained in:
Jonathan Bennett 2024-08-09 00:52:31 -05:00 committed by GitHub
parent 5b4530325f
commit a7da3537e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View File

@ -257,6 +257,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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

View File

@ -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
}

View File

@ -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)