Date / Time on simu now right (and less warnings given by Valgrind)

This commit is contained in:
Bertrand Songis
2016-03-11 22:24:26 +01:00
parent 2b39d703a1
commit 80bc6f2d1a
+20 -2
View File
@@ -1250,8 +1250,26 @@ int usbPlugged() { return false; }
void USART_DeInit(USART_TypeDef* ) { }
ErrorStatus RTC_SetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct) { return SUCCESS; }
ErrorStatus RTC_SetDate(uint32_t RTC_Format, RTC_DateTypeDef* RTC_DateStruct) { return SUCCESS; }
void RTC_GetTime(uint32_t RTC_Format, RTC_TimeTypeDef* RTC_TimeStruct) { }
void RTC_GetDate(uint32_t RTC_Format, RTC_DateTypeDef* RTC_DateStruct) { }
void RTC_GetTime(uint32_t RTC_Format, RTC_TimeTypeDef * RTC_TimeStruct)
{
time_t tme;
time(&tme);
struct tm * timeinfo = localtime(&tme);
RTC_TimeStruct->RTC_Hours = timeinfo->tm_hour;
RTC_TimeStruct->RTC_Minutes = timeinfo->tm_min;
RTC_TimeStruct->RTC_Seconds = timeinfo->tm_sec;
}
void RTC_GetDate(uint32_t RTC_Format, RTC_DateTypeDef * RTC_DateStruct)
{
time_t tme;
time(&tme);
struct tm * timeinfo = localtime(&tme);
RTC_DateStruct->RTC_Year = timeinfo->tm_year - 1900;
RTC_DateStruct->RTC_Month = timeinfo->tm_mon + 1;
RTC_DateStruct->RTC_Date = timeinfo->tm_mday;
}
void RTC_TimeStructInit(RTC_TimeTypeDef* RTC_TimeStruct) { }
void RTC_DateStructInit(RTC_DateTypeDef* RTC_DateStruct) { }
void PWR_BackupAccessCmd(FunctionalState NewState) { }