extras/sntp: Correct miscalculation of tv_usec

Missing >>12 inserted
This commit is contained in:
Jeff Kletsky 2018-02-06 21:42:11 -08:00
parent f328da17c1
commit 5ef8a8348a

View file

@ -88,9 +88,9 @@ inline time_t sntp_get_rtc_time(int32_t *us) {
// Check for timer wrap // Check for timer wrap
sntp_check_timer_wrap(tim); sntp_check_timer_wrap(tim);
base = sntp_base + tim - tim_ref; base = sntp_base + tim - tim_ref;
secs = base * cal / (1000000U<<12); secs = (base * cal) / (1000000U<<12);
if (us) { if (us) {
*us = base * cal % (1000000U<<12); *us = ((base * cal) % (1000000U<<12)) >>12;
} }
return secs; return secs;
} }