Consider this scenario:

  • You use a Windows Vista based computer and the computer supports HPET.
  • Any time synchronization service such as Windows Timer Services is not used.
  • The API such as WaitForSingleObject is used to timeout at a specified time.
  • Get the system time immediately after WaitForSingleObject API returns.

WaitForSingleObject API is expected to time-out at the specified time. But the system time obtained at this point may not have reached the specified time.

In WaitForSingleObject API, set the parameter so that timeout will occur at 09:00:00 in the next morning. Now, when WaitForSingleObject API is expired, the obtained time may be 08:59:59.

Leave a Reply