In 2.6 I've ended up doing
Code: Select all
Index: os/various/chrtclib.c
===================================================================
--- os/various/chrtclib.c
+++ os/various/chrtclib.c
@@ -215,7 +215,12 @@
#endif
struct tm timp;
+#if defined __GNUC__
localtime_r(&tv_sec, &timp);
+#else
+ struct tm *t = localtime(&tv_sec);
+ memcpy(&timp, t, sizeof(struct tm));
+#endif
stm32_rtc_tm2bcd(&timp, ×pec);
rtcSetTime(rtcp, ×pec);
}
@@ -257,7 +262,13 @@
RTCTime timespec = {0};
rtcGetTime(rtcp, ×pec);
+#if defined __GNUC__
localtime_r((time_t *)&(timespec.tv_sec), timp);
+#else
+ struct tm *t = localtime((time_t *)&(timespec.tv_sec));
+ memcpy(&timp, t, sizeof(struct tm));
+#endif
+
}
/**
I know it's different in 3.0, but it does use localtime_r also.
But it could be that I am missing something.