Improved handling of fps in Linux and Windows

The commit improves the handling of frames per second in Linux and Windows. A major change is from using processor-time to system-time, since system-time is more robust and precise than processor-time. The changes have been tested under different kinds of loads in both Windows and Linux, and the behaviour corresponds generally to the way GM handles fps. The way sleep is handled is partly based on dazappa's suggested changes. The commit is an improvement over dazappa's suggested changes.

While I have tested and confirmed that the changes work, I would like others to review the changes before they are pulled.