void BSP_Time_Adjust(u32 ctime) { PWR_BackupAccessCmd(ENABLE); // enable access backup register RTC_WaitForLastTask(); // Wait until last write operation on RTC registers has finished RTC_SetCounter(ctime); // Change the current time RTC_WaitForLastTask(); // Wait until last write operation on RTC registers has finished PWR_BackupAccessCmd(DISABLE); }