涡轮增压 C++时间分辨率高达毫秒

发布于 2024-09-11 03:19:04 字数 161 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一人独醉 2024-09-18 03:19:04

这是古老的 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.

信仰 2024-09-18 03:19:04

使用 Windows QueryPerformanceCounter(和 QueryPerformanceFrequency)。

Use Windows QueryPerformanceCounter (and QueryPerformanceFrequency).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文