Win32 environment clock programming

zhaozj2021-02-08  564

Win32 environment clock programming

● Fan Yipe (

FreeMind)

Return

In the game programming, it is a very necessary job for accurate time control. In the long Dos era, all programmers are accustomed to doing this work on taking over and modifying time interruptions. In the Win32 era, this kind of masonry has been completely abandoned, and now we have several ways to do this. The first form: gettickcount () Windows NT 3.5 and higher, the accuracy is 10ms Windows NT 3.1 and higher, the accuracy is 16ms Windows 95 and higher, the accuracy is 55ms, this is only available for low precision Application Occasion 2: TimegetTime () Accuracy is about 1 ms, this formula is suitable for most applications, third format: high-resolution timer queryperformancecounter () with queryperFormanceFrequency (), this formula is actually in high-precision applications actually, third In most cases, it is implemented from the Intel's RDTSC (Read Time Stamp Counter) instruction. Therefore, directly based on RDTSC to complete all the functions, it should be unfair, the war is invincible ...

Note: Only talk about it, don't talk about specific programming, please refer to MSDN and Intel's technical manual

转载请注明原文地址:https://www.9cbs.com/read-182.html

New Post(0)