kernel: Improve precision of ticks and ms conversions
kernel: Improve precision of ticks and ms conversions

The following 2 improvements are contained in this patch:

- When converting from ms to ticks, instead of using hardware cycles
  per tick, use hardware cycles per second. This ensures that the
  multiplication is done before the division, increasing precision.
- When converting from ticks to ms, instead of using cycles per tick
  and cycles per sec, use ticks per sec. This too increases the
  precision.

The concept is to make the dividend as large as possible compared to the
divisor in order to lose as little precision as possible.

Fixes #8898
Fixes #9459
Fixes #9466
Fixes #9468

Signed-off-by: Vinayak Kariappa Chettimada <e780c9f87dc729ad454f47292ad82c8652353064@nordicsemi.no>
Signed-off-by: Carles Cufi <853081dc8dca4fe6a7e3c984752718b5db36e060@nordicsemi.no>

nashif/zephyr,ldts/zephyr,explora26/zephyr,finikorg/zephyr,galak/zephyr,kraj/zephyr,GiulianoFranchetto/zephyr,punitvara/zephyr,kraj/zephyr,ldts/zephyr,explora26/zephyr,kraj/zephyr,explora26/zephyr,punitvara/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,GiulianoFranchetto/zephyr,finikorg/zephyr,Vudentz/zephyr,Vudentz/zephyr,GiulianoFranchetto/zephyr,kraj/zephyr,zephyrproject-rtos/zephyr,explora26/zephyr,punitvara/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,Vudentz/zephyr,nashif/zephyr,zephyrproject-rtos/zephyr,punitvara/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,nashif/zephyr,punitvara/zephyr,ldts/zephyr,galak/zephyr,GiulianoFranchetto/zephyr,ldts/zephyr,ldts/zephyr,nashif/zephyr,kraj/zephyr,explora26/zephyr,nashif/zephyr,finikorg/zephyr,Vudentz/zephyr,finikorg/zephyr,finikorg/zephyr,galak/zephyr,Vudentz/zephyr,GiulianoFranchetto/zephyr