This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch releases/13.0
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/releases/13.0 by this push:
     new 04ef9357e1b libc/time: Fix POSIX timezone string parsing.
04ef9357e1b is described below

commit 04ef9357e1b8c619bea33c433ce783b24f5f60f2
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;
         }

Reply via email to