diff options
| author | guo <[email protected]> | 2021-12-10 18:43:24 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-10 18:43:24 +0800 |
| commit | 034b41c6fdd3e85da73de6f72ae7ce169f6940de (patch) | |
| tree | 7805eaca43091e8dda9c3f4081826adba722700c /bsp | |
| parent | 8a3ee36b1a611cb1cbfa202b1dcdb48cc9f50ee8 (diff) | |
| parent | b6d90dffcfcf4339166c38d32a626459b4bfada3 (diff) | |
Merge pull request #5360 from iysheng/fix_gmtime
[bsp][stm32] Modify variable name p_tm to tm
Diffstat (limited to 'bsp')
| -rw-r--r-- | bsp/stm32/libraries/HAL_Drivers/drv_rtc.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c b/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c index 16ec84b0da..149e16871b 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c @@ -65,21 +65,21 @@ static rt_err_t set_rtc_time_stamp(time_t time_stamp) { RTC_TimeTypeDef RTC_TimeStruct = {0}; RTC_DateTypeDef RTC_DateStruct = {0}; - struct tm p_tm = {0}; + struct tm tm = {0}; - gmtime_r(&time_stamp, &p_tm); - if (p_tm.tm_year < 100) + gmtime_r(&time_stamp, &tm); + if (tm.tm_year < 100) { return -RT_ERROR; } - RTC_TimeStruct.Seconds = p_tm.tm_sec ; - RTC_TimeStruct.Minutes = p_tm.tm_min ; - RTC_TimeStruct.Hours = p_tm.tm_hour; - RTC_DateStruct.Date = p_tm.tm_mday; - RTC_DateStruct.Month = p_tm.tm_mon + 1 ; - RTC_DateStruct.Year = p_tm.tm_year - 100; - RTC_DateStruct.WeekDay = p_tm.tm_wday + 1; + RTC_TimeStruct.Seconds = tm.tm_sec ; + RTC_TimeStruct.Minutes = tm.tm_min ; + RTC_TimeStruct.Hours = tm.tm_hour; + RTC_DateStruct.Date = tm.tm_mday; + RTC_DateStruct.Month = tm.tm_mon + 1 ; + RTC_DateStruct.Year = tm.tm_year - 100; + RTC_DateStruct.WeekDay = tm.tm_wday + 1; if (HAL_RTC_SetTime(&RTC_Handler, &RTC_TimeStruct, RTC_FORMAT_BIN) != HAL_OK) { |
