Subject: | Fix for Sys::SigAction::Alarm::ssa_alarm() "too big" comparison and tests |
The current code does a lexical comparison, which results in errors for timeouts that are lexically before MAX_INT() but numerically after. For example a 3 hour (10800 second) timeout when compared lexically to MAX_INT()/1_000_000 (about 2147 on my system) passes the test, calls Time::HiRes::ualarm() and fails with:
Time::HiRes::ualarm(-2084901888, 0): negative time not invented yet at tmp/Sys/SigAction/Alarm.pm line 20
I've created a patch and pull request on github here:
https://github.com/labaxter/sys-sigaction/pull/1
This change uses the numerical comparison operator '<=' and changes the unit test to use the smallest number that is both numerically after and lexically before MAX_INT().
Thanks!