Example 18-2 shows a class written for Windows that provides member functions for accurate time delays and also member functions to measure software execution times. This class is added by right-clicking on the project name and inserting an MFC generic class named TimeD. It contains three member functions called Start,Stop,and Delay.
The Start() function is used to start a measurement and Stop() is used to end a time measurement. The Stop() function returns a double floating-point value that is the amount of time in microseconds between Start() and Stop().
The Delay function causes a precision time delay based on the time-stamp cou e Delay function is in milliseconds. This means that a Delay(1000) parameter transferred to causes exacty 1000 ms of delay.
when TimeD is initialized in a program. it reads the microprocessor frequency in MHz from the windows registry file using the Regquery Valueex function after opening it with the Regopenkeyex function. The microprocessor clock frequency is returned in the Micro Frequency class variable