Skip to content

Commit 9da5e48

Browse files
committed
STM32 RTC : skip rtc_write if possible
1 parent 5047ea4 commit 9da5e48

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

targets/TARGET_STM/rtc_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ void rtc_write(time_t t)
207207
RTC_DateTypeDef dateStruct = {0};
208208
RTC_TimeTypeDef timeStruct = {0};
209209

210+
/* if the requested time is the current time, no need to continue */
211+
if (t == rtc_read()) {
212+
return;
213+
}
214+
210215
core_util_critical_section_enter();
211216
RtcHandle.Instance = RTC;
212217

0 commit comments

Comments
 (0)