Changed and tested changes to timing handling code.

The changes may fix issues related to timing
on Linux and Windows.