Check timer for invalid frequency
Precalculate timer tick rate to save a few instructions
Don't use static variables inside functions to avoid checking for initialization
Use static functions inside anonymous namespace for internal linkage
I'm not sure if this test is going to be effective as I don't have hardware to
test on at the moment. As noted in the documentation, Windows XP should be the
only OS where QPC uses a timer source that is non-monotonic(multi-core with
non-syncronized TSC).
timeEndPeriod must be called with the same timer resolution value used in
timeBeginPeriod. When the process exits the timer resolution is restored anyway
so this is not very important.