QueryPerformanceCounter - who knew? (1 Viewer)

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:11
Joined
Feb 28, 2001
Messages
27,187
There IS such a thing as a high-performance timer in Windows. You need an API call to use it - but it exists.

Using the "Time" or "Now" functions gets you time to the second because the routine intentionally rounds it. Using the "Timer" function, you can get something as "milliseconds since midnight" but that timer ticks in 1/60th of a second in the USA. (Other venues - 50th of a second.) The API-based precision timer can do much faster ticks, down to microseconds as a viable unit. However, the machine instructions to get that timer add a slight constant bias since on CPUs with a slower clock, instruction times are commensurate with the internal crystal clock ticks.
 

isladogs

MVP / VIP
Local time
Today, 16:11
Joined
Jan 14, 2017
Messages
18,227
The timer intervals depend on the system clock which is hardware dependant rather than location dependant.
Normally updated 64 times per second. Certainly nothing to do with AC mains frequency in each country

There are several methods of measuring time intervals to millisecond intervals and the high resolution timer method allows you to measure to 0.1 microseconds. But precision and accuracy do not necessarily correlate.

I have tried many different methods of timing in my various speed comparison tests and some time ago wrote an article discussing the various approaches
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 11:11
Joined
Apr 27, 2015
Messages
6,341
The timer intervals depend on the system clock which is hardware dependant rather than location dependant.
Normally updated 64 times per second. Certainly nothing to do with AC mains frequency in each country

There are several methods of measuring time intervals to millisecond intervals and the high resolution timer method allows you to measure to 0.1 microseconds. But precision and accuracy do not necessarily correlate.

I have tried many different methods of timing in my various speed comparison tests and some time ago wrote an article discussing the various approaches
Very impressive article Colin, don't know how I missed it...
 

isladogs

MVP / VIP
Local time
Today, 16:11
Joined
Jan 14, 2017
Messages
18,227
Thanks. Haven't yet watched Daniel's video.
Does he cover any additional methods I haven't included?
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 11:11
Joined
Apr 27, 2015
Messages
6,341
Thanks. Haven't yet watched Daniel's video.
Does he cover any additional methods I haven't included?
No sir. TBT, your article is more comprehensive. He does show some examples on how to incorporate his methods, including a Class Module (cool points)
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:11
Joined
Feb 28, 2001
Messages
27,187
Normally updated 64 times per second. Certainly nothing to do with AC mains frequency in each country

Technically, also depends on the age of the computer, and YES, the older machines DID depend on the wall current frequency.
 

isladogs

MVP / VIP
Local time
Today, 16:11
Joined
Jan 14, 2017
Messages
18,227
UK is 50Hz AC but the system clock updates 64 times per second.
AFAIK that frequency still applies even in the latest PCs

Define older in this context. And what is the 'wall' current frequency?
 

jdraw

Super Moderator
Staff member
Local time
Today, 11:11
Joined
Jan 23, 2006
Messages
15,379
Daniel's videos (and his website) are very informative and well done. I know he is not too happy with M$oft at the moment. I think it's great for the rest of us that he is providing a lot of his experiences and practices via youtube videos.
 

Users who are viewing this thread

Top Bottom