无法从GetSystemTime()获得毫秒 [英] Unable to get milliseconds from GetSystemTime()

查看:525
本文介绍了无法从GetSystemTime()获得毫秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试打印秒和毫秒的分辨率计时,并且我正在使用GetSystemTime().

I am trying to print out seconds and milliseconds resolution timing and i am using GetSystemTime().

这是我的代码:

GetSystemTime(&datetime);
RETAILMSG(1,(_T("Time After Data Sent to USB: %d:%d\r\n"), datetime.wSecond, datetime.wMilliseconds));  

我使用RETAILMSG()打印到平台构建器的调试输出,但是我只能打印秒分辨率,因此我会看到类似 48:0 的内容,其中毫秒为空白.

I print to the platform builder debug output using RETAILMSG(), but i am only able to print up to seconds resolution, so i will see something like 48:0 where the milliseconds is blank.

我不确定为什么会这样,因为我没有收到任何投诉.我认为这与RETAILMSG()的实现有关.

I am not sure why this is happening as i receive no complaints. I figure it has something to do with the implementation of RETAILMSG().

我是否可以使用此解决方案或替代品来实现毫秒级分辨率?

Is there a fix for this or a substitute that i can use to achieve milliseconds resolution?

谢谢

我正在Windows Embedded Compact 7中进行开发

推荐答案

在Windows下,时钟分辨率

Under windows, the clock resolution is around 15ms.

如果需要毫秒级的分辨率,则可以使用高性能时钟来测量10µs以下的时间(请参见

If you need millisecond resolution, there is a high performance clock that enables you to measure timebelow 10µs range (see here: Acquiring high-resolution time stamps on msdn).

这篇关于无法从GetSystemTime()获得毫秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆