我正在尝试打印出秒和毫秒分辨率计时,我正在使用 GetSystemTime()
。
这是我的代码:
GetSystemTime(&datetime);
RETAILMSG(1,(_T("Time After Data Sent to USB: %d:%d\r\n"), datetime.wSecond, datetime.wMilliseconds));
我使用 RETAILMSG()
打印到平台构建器调试输出,但我只能打印到秒分辨率,所以我会看到类似 48:0 毫秒为空。
我不确定为什么会这样,因为我没有收到任何投诉。我认为它与 RETAILMSG()
的实现有关。
是否有解决此问题的方法或可用于实现毫秒分辨率的替代方法?
谢谢,
编辑:我在 Windows Embedded Compact 7 中开发
最佳答案
the milliseconds is blank.
I am not sure why this is happening
Embedded Compact documentation对于 GetSystemTime()
声明了关于该问题的以下警告:
Millisecond granularity may not be supported by a hardware platform. The caller of this function should not rely on more than second granularity.
关于c++ - 无法从 GetSystemTime() 获取毫秒数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31950972/