timers: truncate decimal values
Reverts some timers behavior back to as it was before 2930bd13.
That commit introduced an unintended change which allowed non-integer timeouts to actually exist since the value is no longer converted to an integer via a TimeWrap handle directly.
Even with the fix in e9de4354 non-integer timeouts are still indeterministic, because libuv does not support them.
This fixes the issue by emulating the old behavior: truncate the _idleTimeout
before using it.
See comments in https://github.com/nodejs/node/pull/24214 for more background on this.
In hindsight, I actually think this discovery makes 2930bd13 semver-major
. I think that commit has perhaps spread too far to just 'undo' it, so I think reverting the behavior (not necessarily the code) is the best choice of action.
Note: libuv doesn't even support non-integer / sub-millisecond timers so really we can't even support sub-millisecond timers (the only real use for non-integer timeouts). (I don't think supporting sub-millisecond timers is particularly useful, either.)
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines