From 849df4b2a8380845862d8291f80289759160c04a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 30 Jan 2026 03:25:57 -0600 Subject: [PATCH] no host --- esphome/components/time/posix_tz.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/esphome/components/time/posix_tz.cpp b/esphome/components/time/posix_tz.cpp index bed1a3b6690..8c94d1d3e07 100644 --- a/esphome/components/time/posix_tz.cpp +++ b/esphome/components/time/posix_tz.cpp @@ -455,9 +455,11 @@ bool epoch_to_local_tm(time_t utc_epoch, const ParsedTimezone &tz, struct tm *ou } // namespace esphome::time -// Override libc's localtime functions to use our timezone +#ifndef USE_HOST +// Override libc's localtime functions to use our timezone on embedded platforms. // This allows user lambdas calling ::localtime() to get correct local time -// without needing the TZ environment variable (which pulls in scanf bloat) +// without needing the TZ environment variable (which pulls in scanf bloat). +// On host, we use the normal TZ mechanism since there's no memory constraint. // Thread-safe version extern "C" struct tm *localtime_r(const time_t *timer, struct tm *result) { @@ -474,5 +476,6 @@ extern "C" struct tm *localtime(const time_t *timer) { static struct tm localtime_buf; return localtime_r(timer, &localtime_buf); } +#endif // !USE_HOST #endif // USE_TIME_TIMEZONE