Skip to content
Snippets Groups Projects
Commit a2e39a75 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

esp8266/modpybrtc: Simplify multiplication by fixed-point value.

parent 32b7e935
No related branches found
No related tags found
No related merge requests found
...@@ -58,7 +58,7 @@ STATIC mp_obj_t pyb_rtc_make_new(const mp_obj_type_t *type, mp_uint_t n_args, mp ...@@ -58,7 +58,7 @@ STATIC mp_obj_t pyb_rtc_make_new(const mp_obj_type_t *type, mp_uint_t n_args, mp
} }
STATIC uint64_t pyb_rtc_raw_us(uint64_t cal) { STATIC uint64_t pyb_rtc_raw_us(uint64_t cal) {
return system_get_rtc_time() * ((cal >> 12) * 1000 + (cal & 0xfff) / 4) / 1000; return (system_get_rtc_time() * cal) >> 12;
}; };
void pyb_rtc_set_us_since_2000(uint64_t nowus) { void pyb_rtc_set_us_since_2000(uint64_t nowus) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment