This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 5f0c1c8d101 libc/time: Fix POSIX timezone string parsing.
5f0c1c8d101 is described below
commit 5f0c1c8d101c2b2b51a5fdf735c2051b7f5ade50
Author: hanzhijian <[email protected]>
AuthorDate: Fri Jul 24 15:42:30 2026 +0800
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 <[email protected]>
---
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;
}