mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
libc/time: Implement tm::tm_gmtoff field
defined by BSD and GNU library extension: https://www.gnu.org/software/libc/manual/html_node/Broken_002ddown-Time.html Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I33113bc322f038a3602880db4fb9cf93001947ac
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
8617cd94b2
commit
6670bc2b27
@@ -342,18 +342,19 @@ FAR struct tm *gmtime_r(FAR const time_t *timep, FAR struct tm *result)
|
||||
|
||||
/* Then return the struct tm contents */
|
||||
|
||||
result->tm_year = (int)year - 1900; /* Relative to 1900 */
|
||||
result->tm_mon = (int)month - 1; /* zero-based */
|
||||
result->tm_mday = (int)day; /* one-based */
|
||||
result->tm_hour = (int)hour;
|
||||
result->tm_min = (int)min;
|
||||
result->tm_sec = (int)sec;
|
||||
result->tm_year = (int)year - 1900; /* Relative to 1900 */
|
||||
result->tm_mon = (int)month - 1; /* zero-based */
|
||||
result->tm_mday = (int)day; /* one-based */
|
||||
result->tm_hour = (int)hour;
|
||||
result->tm_min = (int)min;
|
||||
result->tm_sec = (int)sec;
|
||||
|
||||
result->tm_wday = clock_dayoftheweek(day, month, year);
|
||||
result->tm_yday = day +
|
||||
clock_daysbeforemonth(result->tm_mon,
|
||||
clock_isleapyear(year));
|
||||
result->tm_isdst = 0;
|
||||
result->tm_wday = clock_dayoftheweek(day, month, year);
|
||||
result->tm_yday = day +
|
||||
clock_daysbeforemonth(result->tm_mon,
|
||||
clock_isleapyear(year));
|
||||
result->tm_isdst = 0;
|
||||
result->tm_gmtoff = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1974,6 +1974,7 @@ static struct tm *timesub(FAR const time_t * const timep,
|
||||
|
||||
tmp->tm_mday = (int)(idays + 1);
|
||||
tmp->tm_isdst = 0;
|
||||
tmp->tm_gmtoff = offset;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user