Skip to content

Commit 8e9f5a8

Browse files
michallencacassis
authored andcommitted
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 <[email protected]>
1 parent 722f319 commit 8e9f5a8

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

nshlib/nsh_timcmds.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ static inline int date_settime(FAR struct nsh_vtbl_s *vtbl,
265265

266266
tm.tm_year = (int)result - 1900;
267267

268+
/* Information about daylight saving not available -> let TZ handle it */
269+
270+
tm.tm_isdst = -1;
271+
268272
/* Convert this to the right form, then set the timer */
269273

270274
ts.tv_sec = utc ? timegm(&tm): mktime(&tm);

0 commit comments

Comments
 (0)