Hello,
This may be the intended behavior or unavaoidable due to system issues but I wanted to point it out just in case.
The return of Time::HiRes::alarm() is inconsistent. In the example below there are 2 problems highlighted:
1) on some systems the remaining time is always 0, no matter what the alarm() is.
2) sometimes the remaining time is wildly inaccurate.
[ -- Time::HiRes v1.9719 on 32 bit perl v5.8.9 -- ]
Time::HiRes::alarm() always returns 0 no matter what alarm() was called before. a normal alarm() does return the whole
seconds of the previous Time::HiRes::alarm()
Updating to 1.9721 makes it behave more like the next section, which is a little more workable :)
[ -- Time::HiRes v1.86 on 32 bit perl v5.8.8 -- ]
Problem: the second says that of 5.5K seconds have passed:
Note: The same commands but w/ normal alarm() set to Time::HiRes::alarm() get the same results (sans the granularity is
gone of course plus the second command goes from 4.2K to 1.4K).
multivac:~ dmuey$ perl -mTime::HiRes -le 'print Time::HiRes::alarm(1000);print Time::HiRes::alarm(100.1);print
Time::HiRes::alarm(0);'
0
999.999936
100.099982
multivac:~ dmuey$ perl -mTime::HiRes -le 'print Time::HiRes::alarm(10000);print Time::HiRes::alarm(100.1);print
Time::HiRes::alarm(0);'
0
4294.967235
100.099986
multivac:~ dmuey$ perl -mTime::HiRes -le 'print Time::HiRes::alarm(100);print Time::HiRes::alarm(5);print
Time::HiRes::alarm(0);'
0
99.999933
4.999983
multivac:~ dmuey$