fix: default timezone UTC0 + NVS-backed set_timezone CLI (P1)#1
Merged
Conversation
P1 fix: MIMI_TIMEZONE hardcoded to PST8PDT causes wrong daily note filenames Root cause: memory_read_recent() and memory_append_today() both call localtime_r() to compute date strings for SPIFFS filenames. With the old PST8PDT default, any user outside US Pacific writes notes to the wrong date file. Changes: - mimi_config.h: change default from PST8PDT to UTC0; add NVS key constants - mimi.c: load timezone from NVS on boot, fall back to MIMI_TIMEZONE default - serial_cli.c: add set_timezone and get_timezone CLI commands (NVS-backed)
# Conflicts: # main/cli/serial_cli.c # main/mimi.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
MIMI_TIMEZONEwas hardcoded to"PST8PDT,M3.2.0,M11.1.0"(US Pacific). Bothmemory_read_recent()andmemory_append_today()calllocaltime_r()to compute daily note filenames on SPIFFS. Any user outside US Pacific ends up writing notes to the wrong date file — e.g. a user in CST+8 at 01:00 local time writes to yesterday's file.Fix
mimi_config.hPST8PDT,M3.2.0,M11.1.0→UTC0(safe universal default)MIMI_NVS_NAMESPACEandMIMI_NVS_KEY_TIMEZONEconstantsmimi.cinit_nvs(), load timezone string from NVS keytimezoneMIMI_TIMEZONE(UTC0) if key is absentsetenv("TZ", ...)+tzset()immediately so all subsequentlocaltime_r()calls use the correct zoneserial_cli.cset_timezone <tz>command: saves to NVS and applies immediately (no reboot needed)get_timezonecommand: shows current active TZ stringUsage