libc/localtime: fix timegm return error when tz with isdst

testcase:
set TZ CEST
time_t t = time(NULL);
struct tm *ts = localtime(&t);
t = timegm(ts);
t will return (time_t)-1;

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2022-09-14 20:56:53 +08:00 committed by Xiang Xiao
parent 1b9ed5725b
commit 7b2371f0ed
1 changed files with 5 additions and 0 deletions

View File

@ -2584,5 +2584,10 @@ time_t mktime(FAR struct tm *tmp)
time_t timegm(FAR struct tm *tmp)
{
if (tmp != NULL)
{
tmp->tm_isdst = 0;
}
return time1(tmp, gmtsub, 0L);
}