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

This commit is contained in:
Paul Sokolovsky 2016-02-12 23:20:52 +02:00
parent 32b7e93535
commit a2e39a756c

View File

@ -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) {