554d523785
The clock_get_ns() API claims to return the period of a clock in nanoseconds. Unfortunately since it returns an integer and a clock's period is represented in units of 2^-32 nanoseconds, the result is often an approximation, and calculating a clock expiry deadline by multiplying clock_get_ns() by a number-of-ticks is unacceptably inaccurate. Introduce a new API clock_ticks_to_ns() which returns the number of nanoseconds it takes the clock to make a given number of ticks. This function can do the complete calculation internally and will thus give a more accurate result. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Luc Michel <luc@lmichel.fr> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20201215150929.30311-2-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
||
---|---|---|
.. | ||
_templates | ||
atomics.rst | ||
bitops.rst | ||
blkdebug.txt | ||
blkverify.txt | ||
block-coroutine-wrapper.rst | ||
build-system.rst | ||
clocks.rst | ||
conf.py | ||
decodetree.rst | ||
fuzzing.rst | ||
index.rst | ||
kconfig.rst | ||
loads-stores.rst | ||
lockcnt.txt | ||
memory.rst | ||
migration.rst | ||
multi-thread-tcg.rst | ||
multiple-iothreads.txt | ||
qapi-code-gen.txt | ||
qom.rst | ||
qtest.rst | ||
rcu.txt | ||
replay.txt | ||
reset.rst | ||
s390-dasd-ipl.rst | ||
secure-coding-practices.rst | ||
stable-process.rst | ||
tcg-icount.rst | ||
tcg-plugins.rst | ||
tcg.rst | ||
testing.rst | ||
tracing.txt | ||
virtio-migration.txt | ||
writing-qmp-commands.txt |