RTC v.1 Driver Error in KEIL and IAR
Posted: Thu Oct 22, 2015 6:10 am
Hello.
In current trunk there is error in RTC v.1 driver:
When no __GNUC__ defined, in line 140 there is double definition of struct tm *t and in line 141 used variable "timp", but must be tim!
And another note: in KEIL there is function localtime_r.
In current trunk there is error in RTC v.1 driver:
Code: Select all
...
128 static void rtc_decode(uint32_t tv_sec,
129 uint32_t tv_msec,
130 RTCDateTime *timespec) {
131 struct tm tim;
132 struct tm *t;
133
134 /* If the conversion is successful the function returns a pointer
135 to the object the result was written into.*/
136 #if defined __GNUC__
137 t = localtime_r((time_t *)&(tv_sec), &tim);
138 osalDbgAssert(t != NULL, "conversion failed");
139 #else
140 struct tm *t = localtime(&tv_sec);
141 memcpy(&timp, t, sizeof(struct tm));
142 #endif
143
144 rtcConvertStructTmToDateTime(&tim, tv_msec, timespec);
145 }
...
When no __GNUC__ defined, in line 140 there is double definition of struct tm *t and in line 141 used variable "timp", but must be tim!
And another note: in KEIL there is function localtime_r.