Skip to content

fix: default timezone UTC0 + NVS-backed set_timezone CLI (P1)#1

Merged
let5sne merged 3 commits into
mainfrom
fix/timezone-default
Feb 28, 2026
Merged

fix: default timezone UTC0 + NVS-backed set_timezone CLI (P1)#1
let5sne merged 3 commits into
mainfrom
fix/timezone-default

Conversation

@let5sne

@let5sne let5sne commented Feb 27, 2026

Copy link
Copy Markdown
Owner

Problem

MIMI_TIMEZONE was hardcoded to "PST8PDT,M3.2.0,M11.1.0" (US Pacific). Both memory_read_recent() and memory_append_today() call localtime_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.h

  • Change default from PST8PDT,M3.2.0,M11.1.0UTC0 (safe universal default)
  • Add MIMI_NVS_NAMESPACE and MIMI_NVS_KEY_TIMEZONE constants

mimi.c

  • After init_nvs(), load timezone string from NVS key timezone
  • Fall back to MIMI_TIMEZONE (UTC0) if key is absent
  • Call setenv("TZ", ...) + tzset() immediately so all subsequent localtime_r() calls use the correct zone

serial_cli.c

  • Add set_timezone <tz> command: saves to NVS and applies immediately (no reboot needed)
  • Add get_timezone command: shows current active TZ string

Usage

set_timezone CST-8                          # China Standard Time
set_timezone JST-9                          # Japan
set_timezone EST5EDT,M3.2.0,M11.1.0        # US Eastern with DST
set_timezone UTC0                           # UTC (default)
get_timezone                                # show current value

OpenClaw Agent and others added 3 commits February 27, 2026 09:32
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
@let5sne let5sne merged commit 4a79aa0 into main Feb 28, 2026
2 checks passed
@let5sne let5sne deleted the fix/timezone-default branch February 28, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant