Replace mktime with timegm in rtc and fs driver

since kernel component should use UTC instead local time

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Icf939e1ab0af8e577105f539d2553bc67b3b3d10
This commit is contained in:
Xiang Xiao
2021-06-22 00:44:48 +08:00
committed by Alan Carvalho de Assis
parent b1cd825cac
commit ae9b5fd306
20 changed files with 38 additions and 39 deletions
+1 -1
View File
@@ -532,7 +532,7 @@ int up_rtc_gettime(FAR struct timespec *tp)
t.tm_year = rtc_bcd2dec((uint8_t) (bcd_years & 0xff)) + 100;
tp->tv_sec = mktime(&t);
tp->tv_sec = timegm(&t);
tp->tv_nsec = 0;
}
+3 -3
View File
@@ -303,7 +303,7 @@ static int rx65n_settime(FAR struct rtc_lowerhalf_s *lower,
* rtc_time is cast compatible with struct tm.
*/
ts.tv_sec = mktime((FAR struct tm *)rtctime);
ts.tv_sec = timegm((FAR struct tm *)rtctime);
ts.tv_nsec = 0;
/* Now set the time (to one second accuracy) */
@@ -446,7 +446,7 @@ static int rx65n_setrelative(FAR struct rtc_lowerhalf_s *lower,
return ret;
}
ts.tv_sec = mktime(&time);
ts.tv_sec = timegm(&time);
ts.tv_nsec = 0;
#elif defined(CONFIG_RTC_HIRES)
@@ -457,7 +457,7 @@ static int rx65n_setrelative(FAR struct rtc_lowerhalf_s *lower,
{
/* Convert to seconds since the epoch */
seconds = mktime(&time);
seconds = timegm(&time);
/* Add the seconds offset. Add one to the number of seconds
* because we are unsure of the phase of the timer.