8.timeGetTime
原文:
The
timeGetTime function retrieves the system time, in milliseconds. The system time is the time elapsed since Windows was started.
DWORD timeGetTime(VOID);
Parameters
This function does not take parameters.
Return Values
Returns the system time, in milliseconds.
Remarks
The only difference between this function and the
timeGetSystemTime function is that
timeGetSystemTime uses the
MMTIME structure to return the system time. The
timeGetTime function has less overhead than
timeGetSystemTime.
Note that the value returned by the
timeGetTime function is a DWORD value. The return value wraps around to 0 every 2^32 milliseconds, which is about 49.71 days.This can cause problems in code that directly uses the
timeGetTime return value in computations, particularly where the value is used to control code execution. You should always use the difference between two
timeGetTime return values in computations.
Windows NT: The default precision of the
timeGetTime function can be five milliseconds or more, depending on the machine. You can use the
timeBeginPeriod
and
timeEndPeriod functions to increase the precision of
timeGetTime. If you do so, the minimum difference between successive values returned by
timeGetTime can be as large as the minimum period value set using
timeBeginPeriod and
timeEndPeriod. Use the
QueryPerformanceCounter and
QueryPerformanceFrequency functions to measure short time intervals at a high resolution,
Windows 95: The default precision of the
timeGetTime function is 1 millisecond. In other words, the
timeGetTime function can return successive values that differ by just 1 millisecond. This is true no matter what calls have been made to the
timeBeginPeriod and
timeEndPeriod functions.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mmsystem.h.
Import Library: Use winmm.lib.
See Also
Multimedia Timers Overview,
Multimedia Timer Functions,
timeGetSystemTime,
MMTIME,
timeGetTime,
timeBeginPeriod,
timeEndPeriod,
QueryPerformanceCounter,
QueryPerformanceFrequency
翻译:
timeGetTime:函数以微妙计的系统时间。该时间为从系统开启算起所经过的时间。
DWORD timeGetTime(VOID);
参数:无参数。
返回值:以微秒值返回系统时间。
备注:该函数与timeGetSystemTime函数的唯一不同是timeGetSystemTime函数使用MMTIME结构返回系统时间。TimeGetSystemTime比timeGetTime需要更多的系统开销。注意timeGetTime函数是一个双字。这个值在0到2^32之间。大约49.71天。如果在代码中直接将该值用于计算,会导致一些问题,特别是用该值来控制代码的执行。一般利用两个timeGetTime函数返回值的不同来用于计算。
Windows NT:该函数的时间精度是五毫秒或更大一些,这取决于机器的性能。可用timeBeginPeriod和timeEndPeriod函数提高timeGetTime函数的精度。如果使用了,连续调用timeGetTime函数,一系列返回值的差异由timeBeginPeriod和timeEndPeriod决定。QueryPerformanceCounter QueryPerformanceFrequency函数用于分辨率要求更高的时间测量。
Windows95 默认分辨率我1毫秒,无论是否调用timeBeginPeriod和timeEndPeriod函数。
博客提及了timeGetTime,不过内容仅列出标题,未给出原文及翻译的具体内容。推测与信息技术中时间获取相关功能有关。
6298

被折叠的 条评论
为什么被折叠?



