diff options
| author | Meco Man <[email protected]> | 2021-02-07 21:49:25 +0800 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2021-02-07 21:49:25 +0800 |
| commit | 86ebf17a2360de740219cf9a5441cb72629c5a1d (patch) | |
| tree | 15dba58cd5f985467300d25e774c6c366dbb0055 /libcpu/arm | |
| parent | 64bd41d6540bc074d3a020b445da664f1067d4bb (diff) | |
localtim改为gmtime
Diffstat (limited to 'libcpu/arm')
| -rw-r--r-- | libcpu/arm/s3c24x0/rtc.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libcpu/arm/s3c24x0/rtc.c b/libcpu/arm/s3c24x0/rtc.c index 3b4c479001..73de840b37 100644 --- a/libcpu/arm/s3c24x0/rtc.c +++ b/libcpu/arm/s3c24x0/rtc.c @@ -125,27 +125,27 @@ 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 tm, *tm_ptr; time_t *time; - RT_ASSERT(dev != RT_NULL); + RT_ASSERT(dev != RT_NULL); - time = (time_t *)args; - switch (cmd) - { + time = (time_t *)args; + switch (cmd) + { case RT_DEVICE_CTRL_RTC_GET_TIME: /* read device */ rt_hw_rtc_get(&tm); - *((rt_time_t *)args) = mktime(&tm); + *((rt_time_t *)args) = timegm(&tm); break; case RT_DEVICE_CTRL_RTC_SET_TIME: - tm_ptr = localtime(time); /* write device */ + tm_ptr = gmtime(time); rt_hw_rtc_set(tm_ptr); break; - } + } - return RT_EOK; + return RT_EOK; } void rt_hw_rtc_init(void) |
