无法从 GetSystemTime() 获取毫秒数
Unable to get milliseconds from GetSystemTime()
我正在尝试打印出秒和毫秒分辨率计时,我正在使用 GetSystemTime()
。
这是我的代码:
GetSystemTime(&datetime);
RETAILMSG(1,(_T("Time After Data Sent to USB: %d:%d\r\n"), datetime.wSecond, datetime.wMilliseconds));
我使用 RETAILMSG()
打印到平台构建器调试输出,但我最多只能打印秒分辨率,所以我会看到类似 48:0[=30= 的内容] 其中毫秒为空。
我不确定为什么会这样,因为我没有收到任何投诉。我认为这与 RETAILMSG()
.
的实施有关
是否有解决此问题的方法或可用于实现毫秒分辨率的替代方法?
谢谢,
编辑:我正在 Windows Embedded Compact 7
中开发
在windows下,时钟分辨率is around 15ms。
如果您需要毫秒分辨率,可以使用高性能时钟来测量低于 10µs 范围的时间(请参阅 msdn 上的 here: Acquiring high-resolution time stamps)。
the milliseconds is blank.
I am not sure why this is happening
GetSystemTime()
的 Embedded Compact documentation 声明了关于该问题的以下警告:
Millisecond granularity may not be supported by a hardware platform. The caller of this function should not rely on more than second granularity.
我正在尝试打印出秒和毫秒分辨率计时,我正在使用 GetSystemTime()
。
这是我的代码:
GetSystemTime(&datetime);
RETAILMSG(1,(_T("Time After Data Sent to USB: %d:%d\r\n"), datetime.wSecond, datetime.wMilliseconds));
我使用 RETAILMSG()
打印到平台构建器调试输出,但我最多只能打印秒分辨率,所以我会看到类似 48:0[=30= 的内容] 其中毫秒为空。
我不确定为什么会这样,因为我没有收到任何投诉。我认为这与 RETAILMSG()
.
是否有解决此问题的方法或可用于实现毫秒分辨率的替代方法?
谢谢,
编辑:我正在 Windows Embedded Compact 7
中开发在windows下,时钟分辨率is around 15ms。
如果您需要毫秒分辨率,可以使用高性能时钟来测量低于 10µs 范围的时间(请参阅 msdn 上的 here: Acquiring high-resolution time stamps)。
the milliseconds is blank.
I am not sure why this is happening
GetSystemTime()
的 Embedded Compact documentation 声明了关于该问题的以下警告:
Millisecond granularity may not be supported by a hardware platform. The caller of this function should not rely on more than second granularity.