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 <hanzhijian@zepp.com>
This commit is contained in:
hanzhijian 2026-07-24 15:42:30 +08:00 committed by Xiang Xiao
parent 8c94a72657
commit 5f0c1c8d10

View file

@ -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;
}