kernel: avoid implementation-defined behavior in timeout calculation
kernel: avoid implementation-defined behavior in timeout calculation

When to->dticks is an int64_t it may happen that the calculated
remaining time is a value that cannot be exactly represented in the
destination int32_t, producing an implementation-defined result which
can include a signal (interrupt).  Cap the maximum delay to the
largest value suported by the int32_t result.

Signed-off-by: Peter Bigot <a4112a160b558d5427af084318038e19a95979ee@nordicsemi.no>

finikorg/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,Vudentz/zephyr,Vudentz/zephyr,nashif/zephyr,finikorg/zephyr,finikorg/zephyr,finikorg/zephyr,nashif/zephyr,Vudentz/zephyr,nashif/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,Vudentz/zephyr,nashif/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,nashif/zephyr,galak/zephyr,galak/zephyr,zephyrproject-rtos/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,Vudentz/zephyr