Skip to content

Commit 068107a

Browse files
committed
TimeService: Fix esp8266 time drift
1 parent 89d3c92 commit 068107a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/utility/time/RTCMillis.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ unsigned long RTCMillis::get()
5454
{
5555
unsigned long current_tick = millis();
5656
unsigned long const elapsed_s = (current_tick - _last_rtc_update_tick) / 1000;
57-
if(elapsed_s) {
58-
set(_last_rtc_update_value + elapsed_s);
59-
}
57+
_last_rtc_update_value += elapsed_s;
58+
_last_rtc_update_tick += elapsed_s * 1000;
6059
return _last_rtc_update_value;
6160
}
6261

0 commit comments

Comments
 (0)