On 21/03/2016 17:02, [email protected] wrote:
>
> Hi,
> This patch replaces get_ticks_per_sec() calls to NANOSECONDS_PER_SECOND.
> Also, as there are no callers, get_ticks_per_sec() has been removed.
> Replacement imporves readability and understandability of code.
>
> Example given by Paolo Bonzini,
>
> timer_mod(fdctrl->result_timer,
> qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 50));
>
> NANOSECONDS_PER_SECOND makes it obvious that the timer will expire in 1/50th
> of a second.
Looks good. I've edited the commit message as follows:
--------
This patch replaces get_ticks_per_sec() calls with the macro
NANOSECONDS_PER_SECOND. Also, as there are no callers, get_ticks_per_sec()
is then removed. This replacement improves the readability and
understandability of code.
For example,
timer_mod(fdctrl->result_timer,
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() /
50));
NANOSECONDS_PER_SECOND makes it obvious that qemu_clock_get_ns
matches the unit of the expression on the right side of the plus.
--------