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
master
gdisirio 2015-06-27 09:12:43 +00:00
parent 90527794f0
commit d2fb55a6bc
2 changed files with 13 additions and 5 deletions

View File

@ -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);
}

View File

@ -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.