From 5f0c1c8d101c2b2b51a5fdf735c2051b7f5ade50 Mon Sep 17 00:00:00 2001 From: hanzhijian Date: Fri, 24 Jul 2026 15:42:30 +0800 Subject: [PATCH] libc/time: Fix POSIX timezone string parsing. When loading a zoneinfo file fails, parse a non-colon-prefixed TZ value as a POSIX timezone string. Treat a successful tzparse() result as success while preserving the leading-colon file-only behavior. Assisted-by: Codex:gpt-5.6 Sol Signed-off-by: hanzhijian --- libs/libc/time/lib_localtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/libc/time/lib_localtime.c b/libs/libc/time/lib_localtime.c index 810ac9c33a0..5dee4270475 100644 --- a/libs/libc/time/lib_localtime.c +++ b/libs/libc/time/lib_localtime.c @@ -2751,8 +2751,8 @@ static int zoneinit(FAR const char *name) int err; err = tzload(name, g_lcl_ptr, TRUE); - if (err != 0 && name != NULL && name[0] == ':' && - tzparse(name, g_lcl_ptr, NULL) != 0) + if (err != 0 && name != NULL && name[0] != ':' && + tzparse(name, g_lcl_ptr, NULL) == 0) { err = 0; }