/* Set the specified timestamp in seconds to RTC.  */
void rtc_write(time_t t)
/* Set the specified timestamp in seconds to RTC.  */
void rtc_write(time_t t)
{
	struct tm *timeinfo = localtime(&t);
	RTC_TimeTypeDef RTC_TimeStruct;
	RTC_TimeStruct.RTC_H12_PMAM = RTC_H12_AM;
	RTC_TimeStruct.RTC_Days = timeinfo->tm_yday;
	RTC_TimeStruct.RTC_Hours = timeinfo->tm_hour;
	RTC_TimeStruct.RTC_Minutes = timeinfo->tm_min;
	RTC_TimeStruct.RTC_Seconds = timeinfo->tm_sec;
	RTC_SetTime(RTC_Format_BIN, &RTC_TimeStruct);
	_memcpy((void*)&rtc_timeinfo, (void*)timeinfo, sizeof(struct tm));
}