diff --git a/arch/arm/src/cxd56xx/cxd56_rtc_lowerhalf.c b/arch/arm/src/cxd56xx/cxd56_rtc_lowerhalf.c index ad9fda6a22c..cf37e35c37d 100644 --- a/arch/arm/src/cxd56xx/cxd56_rtc_lowerhalf.c +++ b/arch/arm/src/cxd56xx/cxd56_rtc_lowerhalf.c @@ -269,7 +269,7 @@ static int cxd56_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) */ @@ -324,7 +324,7 @@ static int cxd56_setalarm(FAR struct rtc_lowerhalf_s *lower, /* Convert the RTC time to a timespec (1 second accuracy) */ - lowerinfo.as_time.tv_sec = mktime((FAR struct tm *)&alarminfo->time); + lowerinfo.as_time.tv_sec = timegm((FAR struct tm *)&alarminfo->time); lowerinfo.as_time.tv_nsec = 0; /* And set the alarm */ diff --git a/arch/arm/src/imxrt/imxrt_rtc_lowerhalf.c b/arch/arm/src/imxrt/imxrt_rtc_lowerhalf.c index 5e2a66b9bb2..116c41eaa19 100644 --- a/arch/arm/src/imxrt/imxrt_rtc_lowerhalf.c +++ b/arch/arm/src/imxrt/imxrt_rtc_lowerhalf.c @@ -237,7 +237,7 @@ static int imxrt_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) */ @@ -311,7 +311,7 @@ static int imxrt_setalarm(FAR struct rtc_lowerhalf_s *lower, /* Convert the RTC time to a timespec (1 second accuracy) */ - ts.tv_sec = mktime((FAR struct tm *)&alarminfo->time); + ts.tv_sec = timegm((FAR struct tm *)&alarminfo->time); ts.tv_nsec = 0; /* Remember the callback information */ diff --git a/arch/arm/src/kinetis/kinetis_rtc_lowerhalf.c b/arch/arm/src/kinetis/kinetis_rtc_lowerhalf.c index f332f84b12b..1111f091efd 100644 --- a/arch/arm/src/kinetis/kinetis_rtc_lowerhalf.c +++ b/arch/arm/src/kinetis/kinetis_rtc_lowerhalf.c @@ -273,7 +273,7 @@ static int kinetis_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; /* Set the time (to one second accuracy) */ @@ -324,7 +324,7 @@ static int kinetis_setalarm(FAR struct rtc_lowerhalf_s *lower, /* Convert from Julian calendar time to epoch time */ - tp.tv_sec = mktime((FAR struct tm *)&alarminfo->time) ; + tp.tv_sec = timegm((FAR struct tm *)&alarminfo->time) ; /* And set the alarm */ @@ -392,7 +392,7 @@ kinetis_setrelative(FAR struct rtc_lowerhalf_s *lower, return ret; } - ts.tv_sec = mktime(&time); + ts.tv_sec = timegm(&time); ts.tv_nsec = 0; #else /* Get the current time in broken out format */ diff --git a/arch/arm/src/lc823450/lc823450_rtc.c b/arch/arm/src/lc823450/lc823450_rtc.c index 03a0c89f746..b5a4952b3b0 100644 --- a/arch/arm/src/lc823450/lc823450_rtc.c +++ b/arch/arm/src/lc823450/lc823450_rtc.c @@ -170,7 +170,7 @@ volatile bool g_rtc_enabled = false; static void tm_divider(struct tm *tm, int divn, int divm) { time_t tt; - tt = mktime(tm); + tt = timegm(tm); tt = (time_t) ((uint64_t)tt * divn / divm); gmtime_r(&tt, tm); } @@ -690,7 +690,7 @@ int up_rtc_getrawtime(FAR struct timespec *ts) #endif /* CONFIG_RTC_DIV */ ts->tv_nsec = 0; - ts->tv_sec = mktime(&tm); + ts->tv_sec = timegm(&tm); return 0; } diff --git a/arch/arm/src/lpc54xx/lpc54_rtc_lowerhalf.c b/arch/arm/src/lpc54xx/lpc54_rtc_lowerhalf.c index d5e69687171..7b106d812e6 100644 --- a/arch/arm/src/lpc54xx/lpc54_rtc_lowerhalf.c +++ b/arch/arm/src/lpc54xx/lpc54_rtc_lowerhalf.c @@ -252,7 +252,7 @@ static int lpc54_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) */ @@ -320,7 +320,7 @@ static int lpc54_setalarm(FAR struct rtc_lowerhalf_s *lower, /* Convert the RTC time to a timespec (1 second accuracy) */ - ts.tv_sec = mktime((FAR struct tm *)&alarminfo->time); + ts.tv_sec = timegm((FAR struct tm *)&alarminfo->time); ts.tv_nsec = 0; /* Remember the callback information */ diff --git a/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c b/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c index ed81d37c6c0..06dc273498e 100644 --- a/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c +++ b/arch/arm/src/max326xx/common/max326_rtc_lowerhalf.c @@ -313,7 +313,7 @@ static int max326_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) */ @@ -382,7 +382,7 @@ static int max326_setalarm(FAR struct rtc_lowerhalf_s *lower, /* Convert the RTC time to a timespec (1 second accuracy) */ - ts.tv_sec = mktime((FAR struct tm *)&alarminfo->time); + ts.tv_sec = timegm((FAR struct tm *)&alarminfo->time); ts.tv_nsec = 0; /* Remember the callback information */ @@ -459,7 +459,7 @@ static int max326_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) diff --git a/arch/arm/src/sam34/sam_rtc.c b/arch/arm/src/sam34/sam_rtc.c index cad96710b81..bba3bd5cfc1 100644 --- a/arch/arm/src/sam34/sam_rtc.c +++ b/arch/arm/src/sam34/sam_rtc.c @@ -803,7 +803,7 @@ int up_rtc_gettime(FAR struct timespec *tp) RTC_CALR_YEAR_SHIFT) - 1900; - tp->tv_sec = mktime(&t); + tp->tv_sec = timegm(&t); tp->tv_nsec = (((rtt_val - g_rtt_offset) & (CONFIG_RTC_FREQUENCY - 1)) * 1000000000ull) / CONFIG_RTC_FREQUENCY; diff --git a/arch/arm/src/stm32/stm32_rtc_lowerhalf.c b/arch/arm/src/stm32/stm32_rtc_lowerhalf.c index 98d38d6f6cc..1d1e40ac0ab 100644 --- a/arch/arm/src/stm32/stm32_rtc_lowerhalf.c +++ b/arch/arm/src/stm32/stm32_rtc_lowerhalf.c @@ -346,7 +346,7 @@ static int stm32_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) */ @@ -469,7 +469,7 @@ static int stm32_setalarm(FAR struct rtc_lowerhalf_s *lower, /* Convert the RTC time to a timespec (1 second accuracy) */ - ts.tv_sec = mktime((FAR struct tm *)&alarminfo->time); + ts.tv_sec = timegm((FAR struct tm *)&alarminfo->time); ts.tv_nsec = 0; /* Remember the callback information */ @@ -541,7 +541,7 @@ static int stm32_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. @@ -599,7 +599,7 @@ static int stm32_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) diff --git a/arch/arm/src/stm32f7/stm32_rtc_lowerhalf.c b/arch/arm/src/stm32f7/stm32_rtc_lowerhalf.c index f244173a997..4edfc6ff4dd 100644 --- a/arch/arm/src/stm32f7/stm32_rtc_lowerhalf.c +++ b/arch/arm/src/stm32f7/stm32_rtc_lowerhalf.c @@ -311,7 +311,7 @@ static int stm32_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) */ @@ -458,7 +458,7 @@ static int stm32_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. diff --git a/arch/arm/src/stm32h7/stm32_rtc_lowerhalf.c b/arch/arm/src/stm32h7/stm32_rtc_lowerhalf.c index 528e11dbcd3..bc855cd10b6 100644 --- a/arch/arm/src/stm32h7/stm32_rtc_lowerhalf.c +++ b/arch/arm/src/stm32h7/stm32_rtc_lowerhalf.c @@ -312,7 +312,7 @@ static int stm32_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) */ @@ -459,7 +459,7 @@ static int stm32_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. diff --git a/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c b/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c index deb23c7acb9..e36bd0b16b8 100644 --- a/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c +++ b/arch/arm/src/stm32l4/stm32l4_rtc_lowerhalf.c @@ -441,7 +441,7 @@ stm32l4_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. diff --git a/arch/renesas/src/rx65n/rx65n_rtc.c b/arch/renesas/src/rx65n/rx65n_rtc.c index ad3f1d1b6d5..c1aefa9ba43 100644 --- a/arch/renesas/src/rx65n/rx65n_rtc.c +++ b/arch/renesas/src/rx65n/rx65n_rtc.c @@ -531,7 +531,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; } diff --git a/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c b/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c index 50481aa45ad..e545848608c 100644 --- a/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c +++ b/arch/renesas/src/rx65n/rx65n_rtc_lowerhalf.c @@ -302,7 +302,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) */ @@ -445,7 +445,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) @@ -456,7 +456,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. diff --git a/arch/sim/src/sim/up_rtc.c b/arch/sim/src/sim/up_rtc.c index 628ae82b56a..d119253f6ef 100644 --- a/arch/sim/src/sim/up_rtc.c +++ b/arch/sim/src/sim/up_rtc.c @@ -83,7 +83,7 @@ static int sim_rtc_rdtime(FAR struct rtc_lowerhalf_s *lower, static int sim_rtc_settime(FAR struct rtc_lowerhalf_s *lower, FAR const struct rtc_time *rtctime) { - g_sim_delta = mktime((FAR struct tm *)rtctime); + g_sim_delta = timegm((FAR struct tm *)rtctime); g_sim_delta *= NSEC_PER_SEC; g_sim_delta += rtctime->tm_nsec; g_sim_delta -= host_gettime(true); diff --git a/arch/z80/src/ez80/ez80_rtc_lowerhalf.c b/arch/z80/src/ez80/ez80_rtc_lowerhalf.c index a40cc236839..8b3bb874233 100644 --- a/arch/z80/src/ez80/ez80_rtc_lowerhalf.c +++ b/arch/z80/src/ez80/ez80_rtc_lowerhalf.c @@ -296,7 +296,7 @@ static int ez80_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) */ @@ -431,7 +431,7 @@ static int ez80_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. diff --git a/drivers/timers/arch_rtc.c b/drivers/timers/arch_rtc.c index 231f321acc9..6e1b90f3a12 100644 --- a/drivers/timers/arch_rtc.c +++ b/drivers/timers/arch_rtc.c @@ -89,7 +89,7 @@ time_t up_rtc_time(void) if (g_rtc_lower->ops->rdtime(g_rtc_lower, &rtctime) == 0) { - time = mktime((FAR struct tm *)&rtctime); + time = timegm((FAR struct tm *)&rtctime); } } @@ -125,7 +125,7 @@ int up_rtc_gettime(FAR struct timespec *tp) ret = g_rtc_lower->ops->rdtime(g_rtc_lower, &rtctime); if (ret == 0) { - tp->tv_sec = mktime((FAR struct tm *)&rtctime); + tp->tv_sec = timegm((FAR struct tm *)&rtctime); tp->tv_nsec = rtctime.tm_nsec; } } diff --git a/drivers/timers/rpmsg_rtc.c b/drivers/timers/rpmsg_rtc.c index f0b3542399b..78b68d52026 100644 --- a/drivers/timers/rpmsg_rtc.c +++ b/drivers/timers/rpmsg_rtc.c @@ -367,7 +367,7 @@ static int rpmsg_rtc_settime(FAR struct rtc_lowerhalf_s *lower, { struct rpmsg_rtc_set_s msg = { - .sec = mktime((FAR struct tm *)rtctime), + .sec = timegm((FAR struct tm *)rtctime), .nsec = rtctime->tm_nsec, }; @@ -388,7 +388,7 @@ static int rpmsg_rtc_setalarm(FAR struct rtc_lowerhalf_s *lower_, (FAR struct rpmsg_rtc_lowerhalf_s *)lower_; struct rpmsg_rtc_alarm_set_s msg = { - .sec = mktime((FAR struct tm *)&alarminfo->time), + .sec = timegm((FAR struct tm *)&alarminfo->time), .nsec = alarminfo->time.tm_nsec, .id = alarminfo->id, }; @@ -419,7 +419,7 @@ rpmsg_rtc_setrelative(FAR struct rtc_lowerhalf_s *lower, time_t time; rpmsg_rtc_rdtime(lower, &alarminfo.time); - time = mktime((FAR struct tm *)&alarminfo.time); + time = timegm((FAR struct tm *)&alarminfo.time); time = time + relinfo->reltime; gmtime_r(&time, (FAR struct tm *)&alarminfo.time); diff --git a/fs/fat/fs_fat32util.c b/fs/fat/fs_fat32util.c index c69cc9d3775..1b758e87a70 100644 --- a/fs/fat/fs_fat32util.c +++ b/fs/fat/fs_fat32util.c @@ -465,7 +465,7 @@ time_t fat_fattime2systime(uint16_t fattime, uint16_t fatdate) /* Then convert the broken out time into seconds since the epoch */ - return mktime(&tm); + return timegm(&tm); #else return 0; #endif diff --git a/sched/clock/clock_initialize.c b/sched/clock/clock_initialize.c index 223e81bb954..7edafb7c96b 100644 --- a/sched/clock/clock_initialize.c +++ b/sched/clock/clock_initialize.c @@ -92,7 +92,7 @@ int clock_basetime(FAR struct timespec *tp) { /* And use the broken-out time to initialize the system time */ - tp->tv_sec = mktime(&rtctime); + tp->tv_sec = timegm(&rtctime); tp->tv_nsec = nsecs; }