summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorMan, Jianting (Meco) <[email protected]>2022-06-22 01:41:06 -0400
committerGitHub <[email protected]>2022-06-22 13:41:06 +0800
commit2c10d5ad01315275254ff59b881a8f323e2636bb (patch)
tree71c98c880693d19bfeb74952532f64d6f7ac9c0a /libcpu
parent4f1f8566f48961c7ee877d1d5226f0be03a06395 (diff)
[rtc] use gmtime_r to replace gmtime (#6012)
* [rtc] use gmtime_r to replace gmtime
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/arm/s3c24x0/rtc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libcpu/arm/s3c24x0/rtc.c b/libcpu/arm/s3c24x0/rtc.c
index 5d374dfadf..b7bbba9a55 100644
--- a/libcpu/arm/s3c24x0/rtc.c
+++ b/libcpu/arm/s3c24x0/rtc.c
@@ -126,7 +126,7 @@ static rt_size_t rtc_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t
static rt_err_t rtc_control(rt_device_t dev, int cmd, void *args)
{
- struct tm tm, *tm_ptr;
+ struct tm tmp;
time_t *time;
RT_ASSERT(dev != RT_NULL);
@@ -135,14 +135,14 @@ static rt_err_t rtc_control(rt_device_t dev, int cmd, void *args)
{
case RT_DEVICE_CTRL_RTC_GET_TIME:
/* read device */
- rt_hw_rtc_get(&tm);
- *((rt_time_t *)args) = timegm(&tm);
+ rt_hw_rtc_get(&tmp);
+ *((rt_time_t *)args) = timegm(&tmp);
break;
case RT_DEVICE_CTRL_RTC_SET_TIME:
/* write device */
- tm_ptr = gmtime(time);
- rt_hw_rtc_set(tm_ptr);
+ gmtime_r(time, &tmp);
+ rt_hw_rtc_set(&tmp);
break;
}