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
commit 64477941fea82d7c0b2b3fe8ca1adbbea46273d4 Author: v-liuchenxu3 <[email protected]> AuthorDate: Thu Sep 11 21:16:57 2025 +0800 libc/time: Fall back to standard time in time1() when the DST conversion fails. When DST time conversion fails, fallback to standard time conversion. Signed-off-by: v-liuchenxu3 <[email protected]> Signed-off-by: ganjing <[email protected]> --- libs/libc/time/lib_localtime.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libs/libc/time/lib_localtime.c b/libs/libc/time/lib_localtime.c index 3d6823ebbfb..e77bc89aa4b 100644 --- a/libs/libc/time/lib_localtime.c +++ b/libs/libc/time/lib_localtime.c @@ -2792,6 +2792,23 @@ static time_t time1(FAR struct tm *tmp, } } + /* DST fallback: if tm_isdst=1 fails, try as standard time */ + + if (!okay && tmp->tm_isdst > 0) + { + int isdst = tmp->tm_isdst; + + tmp->tm_isdst = 0; + + t = time2(tmp, funcp, offset, &okay); + if (okay) + { + return t; + } + + tmp->tm_isdst = isdst; + } + return -1; }
