On Wed, 9 Dec 2020 at 14:11, Richard Henderson <richard.hender...@linaro.org> wrote: > This function is truncating back to 64.0, dropping the 32 high bits and 32 low > bits. We lose bits at 2^64 ns ~= 584 years. Which is still unreasonably > long, > but could still be had from a timer setting ~= never. > > An alternate to an assert could be saturation. Input "infinity", return > "infinity". More or less.
Might be an idea. We have never really properly nailed down what QEMU's simulation of time does when it hits INT64_MAX nanoseconds (which is the furthest forward absolute time you can set a QEMUTimer). In particular if you use the icount sleep=on option it is actually possible for the simulation to get there (set a far-future timer, no other interrupts or simulation input, do a sleep-til-next-interrupt) and I have no idea what QEMU should do at that point (print "Welcome to the end of the universe" and exit?). FWIW, the reason I made this API take a 64-bit tick count and return a 64-bit nanosecond count is because we do have timer devices where the tick count is 64 bits (eg the Arm Generic Timers in the CPU) and the QEMUTimer APIs all want "expiry date in nanoseconds as a signed 64-bit value". thanks -- PMM