diff --git a/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c b/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c index afc50ba6d..13b2cf9b9 100644 --- a/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c +++ b/os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c @@ -125,15 +125,21 @@ static time_t rtc_encode(const RTCDateTime *timespec) { * * @notapi */ -static void rtc_decode(uint32_t tv_sec, uint32_t tv_msec, - RTCDateTime *timespec) { +static void rtc_decode(uint32_t tv_sec, + uint32_t tv_msec, + RTCDateTime *timespec) { struct tm tim; - struct tm *canary; + struct tm *t; /* If the conversion is successful the function returns a pointer to the object the result was written into.*/ - canary = localtime_r((time_t *)&(tv_sec), &tim); - osalDbgCheck(&tim == canary); +#if defined __GNUC__ + t = localtime_r((time_t *)&(tv_sec), &tim); + osalDbgAssert(t != NULL, "conversion failed"); +#else + struct tm *t = localtime(&tv_sec); + memcpy(&timp, t, sizeof(struct tm)); +#endif rtcConvertStructTmToDateTime(&tim, tv_msec, timespec); } diff --git a/readme.txt b/readme.txt index a6d65539c..962607c6a 100644 --- a/readme.txt +++ b/readme.txt @@ -74,6 +74,8 @@ ***************************************************************************** *** 3.0.0p6 *** +- HAL: Removed call to localtime_r() function for non-GNU compilers in + STM32F1xx RTC driver. - DEM: Fixed the FatFS demo timeout, now it is expressed in milliseconds. - DEM: Added -Wundef to all the demos and test programs in order to find common error cases.