Главная страница | назад





Article #19519: Accurate timing in WIN32

 Question and Answer Database
FAQ: FAQ4519C — Accurate timing in WIN32
Category: Windows API
Platform: All-32Bit
Product: C++Builder1.0, C++Builder3.x, C++Builder4.x,
Question:
What is the most accurate way for me to measure the current
time in a C++ program? I am hoping that I can get a measure
of time that is accurate to the nearest millisecond.
Answer:
The Win32 api function GetSystemTime will return the system time taken
from the RTC (real time clock circuitry on motherboard)
In Win9x, the frequency of this timer interrupt is around 18Hz, or one
interrupt every 55 milliseconds.
For even higher accuracy, QueryPerformanceCounter will be more
appropriate. You can use QueryPerformanceFrequency to determine the
performance of an available high-resolution counter.
8/4/99 11:59:18 AM

Last Modified: 01-SEP-99