From 8e9f5a8d3aa318fb9b3fb67db3577fac7cf84116 Mon Sep 17 00:00:00 2001 From: Michal Lenc Date: Fri, 17 Apr 2026 11:57:40 +0200 Subject: [PATCH] nshlib/nsh_timcmds.c: fix incorrect time set during summer time Value zero in tm_isdst means daylight saving time (or summer time) is not in effect. This is obviously not true for half of the year in most timezones and keeping it at zero leads to incorrect time being set. This commit sets tm_isdst to -1, which means the information is not available and it should be handled according to timezone rules. Signed-off-by: Michal Lenc --- nshlib/nsh_timcmds.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nshlib/nsh_timcmds.c b/nshlib/nsh_timcmds.c index a0952acc1..de5dd8adf 100644 --- a/nshlib/nsh_timcmds.c +++ b/nshlib/nsh_timcmds.c @@ -265,6 +265,10 @@ static inline int date_settime(FAR struct nsh_vtbl_s *vtbl, tm.tm_year = (int)result - 1900; + /* Information about daylight saving not available -> let TZ handle it */ + + tm.tm_isdst = -1; + /* Convert this to the right form, then set the timer */ ts.tv_sec = utc ? timegm(&tm): mktime(&tm);