涡轮增压 C++时间分辨率高达毫秒
Turbo C++ v1.01 发布的 time.h 中的clock_t 含义最多只能达到 0.0545XX 秒,这意味着我想要用该库实现更高精度的任何计时都是不可能的。
我想知道是否有人知道老 TurboC++ 可以使用的好库或方法,我可以使用它来代替 time.h 调用以获得更好的精度?
The clock_t implications in time.h released with Turbo C++ v1.01 are good only up to 0.0545XX seconds, meaning any timing I want to do with higher precision is impossible with that library.
I was wondering if anyone knew a good library or method available to elder TurboC++ that I could use instead of time.h calls for better precision?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是古老的 DOS 版 Turbo C++ 吗?我认为该数字是默认 DOS 性能计时器的约 1/18 秒。
您可以加快计时器的速度,但必须编写一个中断例程来拦截该计时器并仅传递一些中断。或者你会从 DOS 的其他部分得到奇怪的行为。我在某个地方有这方面的代码,我也许可以挖掘出来。
Is this the ancient Turbo C++ for DOS? I recognise that number as the ~1/18th of a second of the default DOS performance timer.
You can speed up the timer, but you'll have to write an interrupt routine that intercepts that timer and only passes on some of the interrupts. Or you'll get strange behavior from other parts of DOS. I have code for this somewhere which I may be able to dig out.
使用 Windows QueryPerformanceCounter(和 QueryPerformanceFrequency)。
Use Windows QueryPerformanceCounter (and QueryPerformanceFrequency).