mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
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:
parent
722f3193ce
commit
8e9f5a8d3a
1 changed files with 4 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue