diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-04-26 11:17:48 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-04-26 12:01:48 -0400 |
commit | 9abf541f7f70068b6f7567481739ca6374f1fd57 (patch) | |
tree | 2d3feeaa192761116fb7eee48d1b8cde46b86a49 /src/or/circuitmux_ewma.c | |
parent | 7cbc44eeb19831bc467f8e1b87062ed1c87934d5 (diff) | |
download | tor-9abf541f7f70068b6f7567481739ca6374f1fd57.tar.gz tor-9abf541f7f70068b6f7567481739ca6374f1fd57.zip |
Add a function to compute millisecond time difference quickly.
Our main function, though accurate on all platforms, can be very
slow on 32-bit hosts. This one is faster on all 32-bit hosts, and
accurate everywhere except apple, where it will typically be off by
1%. But since 32-bit apple is a relic anyway, I think we should be
fine.
Diffstat (limited to 'src/or/circuitmux_ewma.c')
-rw-r--r-- | src/or/circuitmux_ewma.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/or/circuitmux_ewma.c b/src/or/circuitmux_ewma.c index a8a645ca57..a360327f8e 100644 --- a/src/or/circuitmux_ewma.c +++ b/src/or/circuitmux_ewma.c @@ -626,11 +626,8 @@ cell_ewma_get_current_tick_and_fraction(double *remainder_out) } monotime_coarse_t now; monotime_coarse_get(&now); - // XXXX this does a division operation that can be slow on 32-bit - // XXXX systems. - int32_t msec_diff = - (int32_t)monotime_coarse_diff_msec(&start_of_current_tick, - &now); + int32_t msec_diff = monotime_coarse_diff_msec32(&start_of_current_tick, + &now); if (msec_diff > (1000*EWMA_TICK_LEN)) { unsigned ticks_difference = msec_diff / (1000*EWMA_TICK_LEN); monotime_coarse_add_msec(&start_of_current_tick, |