Heikki Linnakangas <hlinnaka@iki.fi> writes:
> This issue is present on newer versions still.
Here's the problem:
long sleep_ms = (long) (sleep * 1000);
If "sleep" is less than 0.0005, sleep_ms rounds to zero, which
results in the subsequent setitimer disarming rather than
arming the interrupt.
There is an uncommented
if (sleep == 0)
continue;
in the loop, which I bet some cowboy added to fix the zero-wait
problem you complained of. But it's doing the wrong thing because
it checks sleep not sleep_ms.
We should change this to test sleep_ms, and we should probably
fix the code that says what the wait interval is to print
sleep_ms/1000.0 not sleep. And some more comments would be good.
regards, tom lane