Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds MESHTASTIC_EXCLUDE_TZ option #4423

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -312,4 +313,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif

#include "DebugConfiguration.h"
#include "RF95Configuration.h"
#include "RF95Configuration.h"
4 changes: 4 additions & 0 deletions src/gps/RTC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -264,4 +265,7 @@ time_t gm_mktime(struct tm *tm)
setenv("TZ", "UTC0", 1);
}
return res;
#else
return mktime(tm);
#endif
}
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,13 +689,15 @@ 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 {
setenv("TZ", "GMT0", 1);
}
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)

Expand Down
Loading