aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2015-06-27 09:12:43 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2015-06-27 09:12:43 +0000
commitd2fb55a6bc64b2f793017589a7b1faabf2e33b28 (patch)
tree6b2b3280889f285e761d4c7a69498e036adf86f6 /os/hal/ports/STM32/LLD
parent90527794f02f544505e34b89687401aeaa964e35 (diff)
downloadChibiOS-d2fb55a6bc64b2f793017589a7b1faabf2e33b28.tar.gz
ChibiOS-d2fb55a6bc64b2f793017589a7b1faabf2e33b28.tar.bz2
ChibiOS-d2fb55a6bc64b2f793017589a7b1faabf2e33b28.zip
Removed call to localtime_r() function for non-GNU compilers.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8056 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/STM32/LLD')
-rw-r--r--os/hal/ports/STM32/LLD/RTCv1/rtc_lld.c16
1 files changed, 11 insertions, 5 deletions
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);
}