Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
AdRainty
rt-thread
提交
f073911c
R
rt-thread
项目概览
AdRainty
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f073911c
编写于
2月 07, 2021
作者:
mysterywolf
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
解决底层驱动格林威治时间与当地时间胡乱使用的问题 mktime函数改为timegm函数
上级
852d7d75
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
83 addition
and
65 deletion
+83
-65
bsp/apollo2/board/rtc.c
bsp/apollo2/board/rtc.c
+2
-1
bsp/at32/Libraries/rt_drivers/drv_rtc.c
bsp/at32/Libraries/rt_drivers/drv_rtc.c
+2
-1
bsp/bluetrum/libraries/hal_drivers/drv_rtc.c
bsp/bluetrum/libraries/hal_drivers/drv_rtc.c
+3
-2
bsp/essemi/es32f0271/drivers/drv_rtc.c
bsp/essemi/es32f0271/drivers/drv_rtc.c
+2
-1
bsp/essemi/es32f0334/drivers/drv_rtc.c
bsp/essemi/es32f0334/drivers/drv_rtc.c
+2
-1
bsp/essemi/es32f0654/drivers/drv_rtc.c
bsp/essemi/es32f0654/drivers/drv_rtc.c
+2
-1
bsp/essemi/es32f369x/drivers/drv_rtc.c
bsp/essemi/es32f369x/drivers/drv_rtc.c
+2
-1
bsp/hc32f4a0/drivers/drv_rtc.c
bsp/hc32f4a0/drivers/drv_rtc.c
+5
-2
bsp/imxrt/libraries/drivers/drv_rtc.c
bsp/imxrt/libraries/drivers/drv_rtc.c
+3
-1
bsp/lpc55sxx/Libraries/drivers/drv_rtc.c
bsp/lpc55sxx/Libraries/drivers/drv_rtc.c
+5
-4
bsp/ls1cdev/drivers/drv_rtc.c
bsp/ls1cdev/drivers/drv_rtc.c
+2
-1
bsp/ls2kdev/drivers/drv_rtc.c
bsp/ls2kdev/drivers/drv_rtc.c
+24
-24
bsp/nrf5x/libraries/drivers/drv_rtc.c
bsp/nrf5x/libraries/drivers/drv_rtc.c
+2
-2
bsp/nuvoton/libraries/m480/rtt_port/drv_rtc.c
bsp/nuvoton/libraries/m480/rtt_port/drv_rtc.c
+4
-3
bsp/nuvoton/libraries/nuc980/rtt_port/drv_rtc.c
bsp/nuvoton/libraries/nuc980/rtt_port/drv_rtc.c
+4
-3
bsp/raspberry-pi/raspi3-32/driver/drv_rtc.c
bsp/raspberry-pi/raspi3-32/driver/drv_rtc.c
+5
-2
bsp/raspberry-pi/raspi3-64/driver/drv_rtc.c
bsp/raspberry-pi/raspi3-64/driver/drv_rtc.c
+4
-2
bsp/swm320-lq100/drivers/drv_rtc.c
bsp/swm320-lq100/drivers/drv_rtc.c
+2
-2
bsp/w60x/drivers/drv_rtc.c
bsp/w60x/drivers/drv_rtc.c
+2
-2
components/dfs/filesystems/elmfat/dfs_elm.c
components/dfs/filesystems/elmfat/dfs_elm.c
+2
-2
components/drivers/rtc/alarm.c
components/drivers/rtc/alarm.c
+2
-5
components/drivers/rtc/soft_rtc.c
components/drivers/rtc/soft_rtc.c
+2
-2
未找到文件。
bsp/apollo2/board/rtc.c
浏览文件 @
f073911c
...
...
@@ -25,6 +25,7 @@
#include <rtthread.h>
#include <rtdevice.h>
#include "am_mcu_apollo.h"
#include <sys/time.h>
#define XT 1
#define LFRC 2
...
...
@@ -78,7 +79,7 @@ static rt_err_t rt_rtc_control(rt_device_t dev, int cmd, void *args)
/* Seconds 0-59 : the 0-59 range */
time_temp
.
tm_sec
=
hal_time
.
ui32Second
;
*
time
=
mktime
(
&
time_temp
);
*
time
=
timegm
(
&
time_temp
);
break
;
...
...
bsp/at32/Libraries/rt_drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -10,6 +10,7 @@
#include "board.h"
#include <rtthread.h>
#include <sys/time.h>
#ifdef BSP_USING_RTC
...
...
@@ -42,7 +43,7 @@ static time_t get_rtc_timestamp(void)
tm_new
.
tm_year
=
ERTC_DateStruct
.
ERTC_Year
+
100
;
LOG_D
(
"get rtc time."
);
return
mktime
(
&
tm_new
);
return
timegm
(
&
tm_new
);
#else
return
RTC_GetCounter
();
#endif
...
...
bsp/bluetrum/libraries/hal_drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -10,6 +10,7 @@
#include "board.h"
#include <time.h>
#include <sys/time.h>
#ifdef BSP_USING_ONCHIP_RTC
...
...
@@ -26,7 +27,7 @@ static struct rt_device rtc;
uint8_t
get_weekday
(
struct
tm
*
const
_tm
)
{
uint8_t
weekday
;
time_t
secs
=
mktime
(
_tm
);
time_t
secs
=
timegm
(
_tm
);
weekday
=
(
secs
/
86400
+
4
)
%
7
;
return
weekday
;
...
...
@@ -115,7 +116,7 @@ void hal_rtc_init(void)
tm_new
.
tm_mday
=
29
;
tm_new
.
tm_mon
=
1
-
1
;
tm_new
.
tm_year
=
2021
-
1900
;
sec
=
mktime
(
&
tm_new
);
sec
=
timegm
(
&
tm_new
);
irtc_time_write
(
RTCCNT_CMD
,
sec
);
}
...
...
bsp/essemi/es32f0271/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -12,6 +12,7 @@
#include <rtthread.h>
#include <rtdevice.h>
#include <string.h>
#include <sys/time.h>
#include "board.h"
#include "drv_rtc.h"
...
...
@@ -96,7 +97,7 @@ static rt_err_t es32f0_rtc_control(rt_device_t dev, int cmd, void *args)
time_temp
.
tm_mday
=
date
->
day
;
time_temp
.
tm_mon
=
date
->
month
-
1
;
time_temp
.
tm_year
=
date
->
year
-
1900
+
2000
;
*
((
time_t
*
)
args
)
=
mktime
(
&
time_temp
);
*
((
time_t
*
)
args
)
=
timegm
(
&
time_temp
);
break
;
}
case
RT_DEVICE_CTRL_RTC_SET_TIME
:
...
...
bsp/essemi/es32f0334/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -12,6 +12,7 @@
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <sys/time.h>
#include <string.h>
#include "board.h"
#include "drv_rtc.h"
...
...
@@ -59,7 +60,7 @@ static rt_err_t es32f0_rtc_control(rt_device_t dev, int cmd, void *args)
time_temp
.
tm_mday
=
date
.
day
;
time_temp
.
tm_mon
=
date
.
month
-
1
;
time_temp
.
tm_year
=
date
.
year
-
1900
+
2000
;
*
((
time_t
*
)
args
)
=
mktime
(
&
time_temp
);
*
((
time_t
*
)
args
)
=
timegm
(
&
time_temp
);
break
;
case
RT_DEVICE_CTRL_RTC_SET_TIME
:
...
...
bsp/essemi/es32f0654/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -12,6 +12,7 @@
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <sys/time.h>
#include <string.h>
#include "board.h"
#include "drv_rtc.h"
...
...
@@ -59,7 +60,7 @@ static rt_err_t es32f0_rtc_control(rt_device_t dev, int cmd, void *args)
time_temp
.
tm_mday
=
date
.
day
;
time_temp
.
tm_mon
=
date
.
month
-
1
;
time_temp
.
tm_year
=
date
.
year
-
1900
+
2000
;
*
((
time_t
*
)
args
)
=
mktime
(
&
time_temp
);
*
((
time_t
*
)
args
)
=
timegm
(
&
time_temp
);
break
;
case
RT_DEVICE_CTRL_RTC_SET_TIME
:
...
...
bsp/essemi/es32f369x/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -12,6 +12,7 @@
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <sys/time.h>
#include <string.h>
#include "board.h"
#include "drv_rtc.h"
...
...
@@ -59,7 +60,7 @@ static rt_err_t es32f0_rtc_control(rt_device_t dev, int cmd, void *args)
time_temp
.
tm_mday
=
date
.
day
;
time_temp
.
tm_mon
=
date
.
month
-
1
;
time_temp
.
tm_year
=
date
.
year
-
1900
+
2000
;
*
((
time_t
*
)
args
)
=
mktime
(
&
time_temp
);
*
((
time_t
*
)
args
)
=
timegm
(
&
time_temp
);
break
;
case
RT_DEVICE_CTRL_RTC_SET_TIME
:
...
...
bsp/hc32f4a0/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -8,8 +8,11 @@
* 2020-10-30 CDT first version
*/
#include
"board.h"
#include
<board.h>
#include <rtdbg.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <sys/time.h>
#ifdef BSP_USING_RTC
...
...
@@ -33,7 +36,7 @@ static time_t hc32_rtc_get_time_stamp(void)
tm_new
.
tm_wday
=
stcRtcDate
.
u8Weekday
;
LOG_D
(
"get rtc time."
);
return
mktime
(
&
tm_new
);
return
timegm
(
&
tm_new
);
}
static
rt_err_t
hc32_rtc_set_time_stamp
(
time_t
time_stamp
)
...
...
bsp/imxrt/libraries/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -10,6 +10,8 @@
*
*/
#include <rtthread.h>
#include <rtdevice.h>
#include <sys/time.h>
#ifdef BSP_USING_RTC
...
...
@@ -39,7 +41,7 @@ static time_t get_timestamp(void)
tm_new
.
tm_mon
=
rtcDate
.
month
-
1
;
tm_new
.
tm_year
=
rtcDate
.
year
-
1900
;
return
mktime
(
&
tm_new
);
return
timegm
(
&
tm_new
);
}
static
int
set_timestamp
(
time_t
timestamp
)
...
...
bsp/lpc55sxx/Libraries/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -8,12 +8,13 @@
* 2018-03-15 Liuguang the first version.
* 2019-07-19 Magicoe The first version for LPC55S6x
*/
#include <rtthread.h>
#include <rtdevice.h>
#include <sys/time.h>
#include "drv_rtc.h"
#include "fsl_common.h"
#include "fsl_rtc.h"
#include <time.h>
#ifdef RT_USING_RTC
...
...
@@ -37,7 +38,7 @@ static time_t get_timestamp(void)
tm_new
.
tm_mon
=
rtcDate
.
month
-
1
;
tm_new
.
tm_year
=
rtcDate
.
year
-
1900
;
return
mktime
(
&
tm_new
);
return
timegm
(
&
tm_new
);
}
static
int
set_timestamp
(
time_t
timestamp
)
...
...
bsp/ls1cdev/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -12,6 +12,7 @@
#include "board.h"
#include "drv_rtc.h"
#include <rtdevice.h>
#include <sys/time.h>
#include "../libraries/ls1c_regs.h"
#include "../libraries/ls1c_rtc.h"
...
...
@@ -44,7 +45,7 @@ static time_t get_timestamp(void)
tm_new
.
tm_mon
=
rtcDate
.
Month
-
1
;
tm_new
.
tm_year
=
rtcDate
.
Year
+
2000
-
1900
;
return
mktime
(
&
tm_new
);
return
timegm
(
&
tm_new
);
}
static
int
set_timestamp
(
time_t
timestamp
)
...
...
bsp/ls2kdev/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -14,7 +14,7 @@
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <
rtthread
.h>
#include <
sys/time
.h>
#include "ls2k1000.h"
#ifdef RT_USING_RTC
...
...
@@ -137,29 +137,29 @@ static rt_err_t rt_rtc_ioctl(rt_device_t dev, int cmd, void *args)
switch
(
cmd
)
{
case
RT_DEVICE_CTRL_RTC_GET_TIME
:
*
t
=
mktime
(
&
tmptime
);
break
;
case
RT_DEVICE_CTRL_RTC_SET_TIME
:
tmptime
.
tm_hour
=
time
.
tm_hour
;
tmptime
.
tm_min
=
time
.
tm_min
;
tmptime
.
tm_sec
=
time
.
tm_sec
;
tmptime
.
tm_year
=
time
.
tm_year
;
tmptime
.
tm_mon
=
time
.
tm_mon
;
tmptime
.
tm_mday
=
time
.
tm_mday
;
rtctm
=
mkrtctime
(
&
tmptime
);
/* write to hw RTC */
hw_rtc
->
sys_toywrite0
=
rtctm
.
sys_toyread0
;
hw_rtc
->
sys_toywrite1
=
rtctm
.
sys_toyread1
;
break
;
case
RT_DEVICE_CTRL_RTC_GET_ALARM
:
break
;
case
RT_DEVICE_CTRL_RTC_SET_ALARM
:
break
;
default:
break
;
case
RT_DEVICE_CTRL_RTC_GET_TIME
:
*
t
=
timegm
(
&
tmptime
);
break
;
case
RT_DEVICE_CTRL_RTC_SET_TIME
:
tmptime
.
tm_hour
=
time
.
tm_hour
;
tmptime
.
tm_min
=
time
.
tm_min
;
tmptime
.
tm_sec
=
time
.
tm_sec
;
tmptime
.
tm_year
=
time
.
tm_year
;
tmptime
.
tm_mon
=
time
.
tm_mon
;
tmptime
.
tm_mday
=
time
.
tm_mday
;
rtctm
=
mkrtctime
(
&
tmptime
);
/* write to hw RTC */
hw_rtc
->
sys_toywrite0
=
rtctm
.
sys_toyread0
;
hw_rtc
->
sys_toywrite1
=
rtctm
.
sys_toyread1
;
break
;
case
RT_DEVICE_CTRL_RTC_GET_ALARM
:
break
;
case
RT_DEVICE_CTRL_RTC_SET_ALARM
:
break
;
default:
break
;
}
return
RT_EOK
;
...
...
bsp/nrf5x/libraries/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -11,7 +11,7 @@
#include "board.h"
#include <rtthread.h>
#include <rtdevice.h>
#include <sys/time.h>
#include <nrfx_rtc.h>
#include <nrfx_clock.h>
...
...
@@ -118,7 +118,7 @@ static rt_err_t rt_hw_rtc_register(rt_device_t device, const char *name, rt_uint
RT_ASSERT
(
device
!=
RT_NULL
);
init_time
=
mktime
(
&
time_new
);
init_time
=
timegm
(
&
time_new
);
if
(
rt_rtc_config
(
device
)
!=
RT_EOK
)
{
return
-
RT_ERROR
;
...
...
bsp/nuvoton/libraries/m480/rtt_port/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -14,6 +14,7 @@
#if defined (BSP_USING_RTC)
#include <rtdevice.h>
#include <sys/time.h>
#include <NuMicro.h>
/* Private define ---------------------------------------------------------------*/
...
...
@@ -183,8 +184,8 @@ static rt_err_t nu_rtc_is_date_valid(const time_t *const t)
if
(
!
initialised
)
{
t_upper
=
mktime
((
struct
tm
*
)
&
tm_upper
);
t_lower
=
mktime
((
struct
tm
*
)
&
tm_lower
);
t_upper
=
timegm
((
struct
tm
*
)
&
tm_upper
);
t_lower
=
timegm
((
struct
tm
*
)
&
tm_lower
);
initialised
=
RT_TRUE
;
}
...
...
@@ -225,7 +226,7 @@ static rt_err_t nu_rtc_control(rt_device_t dev, int cmd, void *args)
tm_out
.
tm_hour
=
hw_time
.
u32Hour
;
tm_out
.
tm_min
=
hw_time
.
u32Minute
;
tm_out
.
tm_sec
=
hw_time
.
u32Second
;
*
time
=
mktime
(
&
tm_out
);
*
time
=
timegm
(
&
tm_out
);
break
;
case
RT_DEVICE_CTRL_RTC_SET_TIME
:
...
...
bsp/nuvoton/libraries/nuc980/rtt_port/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -14,6 +14,7 @@
#if defined (BSP_USING_RTC)
#include <rtdevice.h>
#include <sys/time.h>
#include <NuMicro.h>
#include <drv_sys.h>
...
...
@@ -184,8 +185,8 @@ static rt_err_t nu_rtc_is_date_valid(const time_t *const t)
if
(
!
initialised
)
{
t_upper
=
mktime
((
struct
tm
*
)
&
tm_upper
);
t_lower
=
mktime
((
struct
tm
*
)
&
tm_lower
);
t_upper
=
timegm
((
struct
tm
*
)
&
tm_upper
);
t_lower
=
timegm
((
struct
tm
*
)
&
tm_lower
);
initialised
=
RT_TRUE
;
}
...
...
@@ -226,7 +227,7 @@ static rt_err_t nu_rtc_control(rt_device_t dev, int cmd, void *args)
tm_out
.
tm_hour
=
hw_time
.
u32Hour
;
tm_out
.
tm_min
=
hw_time
.
u32Minute
;
tm_out
.
tm_sec
=
hw_time
.
u32Second
;
*
time
=
mktime
(
&
tm_out
);
*
time
=
timegm
(
&
tm_out
);
break
;
case
RT_DEVICE_CTRL_RTC_SET_TIME
:
...
...
bsp/raspberry-pi/raspi3-32/driver/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -8,12 +8,15 @@
* 2019-07-29 zdzn first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include <sys/time.h>
#include "drv_rtc.h"
#ifdef BSP_USING_RTC
#define RTC_I2C_BUS_NAME "i2c0"
#define RTC_ADDR 0x68
#define RTC_ADDR
0x68
static
struct
rt_device
rtc_device
;
static
struct
rt_i2c_bus_device
*
i2c_bus
=
RT_NULL
;
...
...
@@ -185,7 +188,7 @@ static time_t raspi_get_timestamp(void)
tm_new
.
tm_min
=
((
buf
[
1
]
&
0x7F
)
/
16
+
0x30
)
+
(
buf
[
1
]
&
0x7F
)
%
16
+
0x30
;
tm_new
.
tm_sec
=
((
buf
[
0
]
&
0x7F
)
/
16
+
0x30
)
+
(
buf
[
0
]
&
0x7F
)
%
16
+
0x30
;
return
mktime
(
&
tm_new
);
return
timegm
(
&
tm_new
);
}
static
int
raspi_set_timestamp
(
time_t
timestamp
)
...
...
bsp/raspberry-pi/raspi3-64/driver/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -8,7 +8,9 @@
* 2019-07-29 zdzn first version
*/
#include <rtthread.h>
#include <rtdevice.h>
#include <sys/time.h>
#include "drv_rtc.h"
#ifdef BSP_USING_RTC
...
...
@@ -33,7 +35,7 @@ static time_t raspi_get_timestamp(void)
tm_new
.
tm_min
=
((
buf
[
1
]
&
0x7F
)
/
16
+
0x30
)
+
(
buf
[
1
]
&
0x7F
)
%
16
+
0x30
;
tm_new
.
tm_sec
=
((
buf
[
0
]
&
0x7F
)
/
16
+
0x30
)
+
(
buf
[
0
]
&
0x7F
)
%
16
+
0x30
;
return
mktime
(
&
tm_new
);
return
timegm
(
&
tm_new
);
}
static
int
raspi_set_timestamp
(
time_t
timestamp
)
...
...
bsp/swm320-lq100/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -13,7 +13,7 @@
#include <rtdevice.h>
#include <board.h>
#include <string.h>
#include <time.h>
#include <
sys/
time.h>
/**
* This function will get the weed day from a date.
...
...
@@ -92,7 +92,7 @@ static rt_err_t swm320_rtc_control(rt_device_t dev, int cmd, void *args)
time_temp
.
tm_mday
=
dateTime
.
Date
;
time_temp
.
tm_mon
=
dateTime
.
Month
-
1
;
time_temp
.
tm_year
=
dateTime
.
Year
-
1900
;
*
((
time_t
*
)
args
)
=
mktime
(
&
time_temp
);
*
((
time_t
*
)
args
)
=
timegm
(
&
time_temp
);
break
;
case
RT_DEVICE_CTRL_RTC_SET_TIME
:
rt_enter_critical
();
...
...
bsp/w60x/drivers/drv_rtc.c
浏览文件 @
f073911c
...
...
@@ -11,7 +11,7 @@
#include <rtdevice.h>
#include <rtthread.h>
#include <time.h>
#include <
sys/
time.h>
#include "wm_regs.h"
#include "wm_irq.h"
#include "tls_common.h"
...
...
@@ -42,7 +42,7 @@ static time_t wm_get_timestamp(void)
tm_new
.
tm_min
=
(
ctrl1
&
0x00003f00
)
>>
8
;
tm_new
.
tm_sec
=
ctrl1
&
0x0000003f
;
return
mktime
(
&
tm_new
);
return
timegm
(
&
tm_new
);
}
static
int
wm_set_timestamp
(
time_t
timestamp
)
...
...
components/dfs/filesystems/elmfat/dfs_elm.c
浏览文件 @
f073911c
...
...
@@ -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. */
}
...
...
components/drivers/rtc/alarm.c
浏览文件 @
f073911c
...
...
@@ -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 */
...
...
components/drivers/rtc/soft_rtc.c
浏览文件 @
f073911c
...
...
@@ -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
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录