diff --git a/epicardium/modules/rtc.c b/epicardium/modules/rtc.c index 24cf783ccb8ea0675bec10317ec8a11d8eb674c7..630ece854da06374e18ec0cf5a747a68f241bbec 100644 --- a/epicardium/modules/rtc.c +++ b/epicardium/modules/rtc.c @@ -50,7 +50,7 @@ uint64_t epic_rtc_get_milliseconds(void) void epic_rtc_set_milliseconds(uint64_t milliseconds) { uint32_t sec, subsec; - uint64_t old_milliseconds, new_milliseconds, diff; + uint64_t old_milliseconds, diff; old_milliseconds = epic_rtc_get_milliseconds(); @@ -64,9 +64,7 @@ void epic_rtc_set_milliseconds(uint64_t milliseconds) while (RTC_EnableRTCE(MXC_RTC) == E_BUSY) ; - new_milliseconds = epic_rtc_get_milliseconds(); - - diff = old_milliseconds - new_milliseconds; + diff = old_milliseconds - milliseconds; monotonic_offset += diff; }