diff options
Diffstat (limited to 'components')
| -rw-r--r-- | components/dfs/filesystems/elmfat/dfs_elm.c | 4 | ||||
| -rw-r--r-- | components/drivers/rtc/alarm.c | 7 | ||||
| -rw-r--r-- | components/drivers/rtc/soft_rtc.c | 4 |
3 files changed, 6 insertions, 9 deletions
diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c index 82d04ae0cc..5f69b069bf 100644 --- a/components/dfs/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/filesystems/elmfat/dfs_elm.c @@ -21,7 +21,7 @@ #include "ffconf.h" #include "ff.h" #include <string.h> -#include <time.h> +#include <sys/time.h> /* ELM FatFs provide a DIR struct */ #define HAVE_DIR_STRUCTURE @@ -800,7 +800,7 @@ int dfs_elm_stat(struct dfs_filesystem *fs, const char *path, struct stat *st) tm_file.tm_min = min; /* Minutes: 0-59 */ tm_file.tm_sec = sec; /* Seconds: 0-59 */ - st->st_mtime = mktime(&tm_file); + st->st_mtime = timegm(&tm_file); } /* get st_mtime. */ } diff --git a/components/drivers/rtc/alarm.c b/components/drivers/rtc/alarm.c index ea1b150e7a..d8e4e468a7 100644 --- a/components/drivers/rtc/alarm.c +++ b/components/drivers/rtc/alarm.c @@ -13,10 +13,7 @@ #include <rtthread.h> #include <rtdevice.h> - -#ifndef _WIN32 #include <sys/time.h> -#endif #define RT_RTC_YEARS_MAX 137 #ifdef RT_USING_SOFT_RTC @@ -98,8 +95,8 @@ static void alarm_wakeup(struct rt_alarm *alarm, struct tm *now) { case RT_ALARM_ONESHOT: { - sec_alarm = mktime(&alarm->wktime); - sec_now = mktime(now); + sec_alarm = timegm(&alarm->wktime); + sec_now = timegm(now); if (((sec_now - sec_alarm) <= RT_ALARM_DELAY) && (sec_now >= sec_alarm)) { /* stop alarm */ diff --git a/components/drivers/rtc/soft_rtc.c b/components/drivers/rtc/soft_rtc.c index 6a04314675..240301f683 100644 --- a/components/drivers/rtc/soft_rtc.c +++ b/components/drivers/rtc/soft_rtc.c @@ -8,7 +8,7 @@ * 2018-01-30 armink the first version */ -#include <time.h> +#include <sys/time.h> #include <string.h> #include <rtthread.h> #include <rtdevice.h> @@ -126,7 +126,7 @@ int rt_soft_rtc_init(void) #endif init_tick = rt_tick_get(); - init_time = mktime(&time_new); + init_time = timegm(&time_new); soft_rtc_dev.type = RT_Device_Class_RTC; |
