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 <michallenc@seznam.cz>
This commit is contained in:
Michal Lenc 2026-04-17 11:57:40 +02:00 committed by Alan C. Assis
parent 722f3193ce
commit 8e9f5a8d3a

View file

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