Refactored platform-specific code

Moved functions from .h to .cpp files
Changed Linux time function

With CLOCK_MONOTONIC_RAW, the timer should never go back in time.