|Hope you don't mind me posting this as a second question, but wanted to catch attention of anyone who is especially knowledgeable about timeGetTime as well.
Here is the simple code I'm using:
static DWORD dwt_was;
Also - it's not the timer wrap around
I have just got it here set a break point on the dwt-dwt line and it shows:
How can timeGetTime() go backwards in time?
In case it is relevant this is on a Lenovo Thinkpad Edge e520
ALL FIVE TIMERS ARE INACCURATE - even when they are constrained to a single core:
They all jump back in time frequently on this machine. I have tested them all constrained to a single core.
The only thing I can think of is to try a best guess averaging process as described in this article but not convinced it will be much of an improvement or worth the work involved:
On the whole it works reasonably well most of the time. Only now and again get these glitches, they go back in time perhaps every second or two, by a ms or two - and with the metronome typically only playing a few notes per second at most, the chance of hitting a major glitch is fairly small.
I think that's the only reason that it is working as a functional metronome on my computer. It's actually pretty good, but wanted to make it more accurate than it is already.
Also this two discussion:
There's also the KeQueryPerformanceCounter but I think that might just be for writers of Drivers - and with all the other ones not working don't know if it would fix the issue anyway.
There's the Windows timestamp project here:
but it seems to be work in progress, don't think you can actually use it in your apps yet??
If it can't be fixed, I'm also interested in any setting I can ask the user to set on their computer if they want to have the highest possible accuracy of timing? E.g. to switch off some power saving frequency adjusting feature or something?
The only other thing I can think of is to write to midi, convert the midi to audio, and play the audio - that is well timed, but not possible to do in real time.
(sorry forgot you can edit these posts - hence all those deleted extra messages below).
modified 15-Mar-13 3:39am.