亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 5574 | 回復(fù): 0
打印 上一主題 下一主題

timeGetTime API函數(shù) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2008-07-28 15:18 |只看該作者 |倒序?yàn)g覽
想在程序中加一個(gè)計(jì)時(shí)的功能,記錄從開始游戲時(shí)經(jīng)過的時(shí)間,以秒為單位。翻了下資料,發(fā)現(xiàn)timeGetTime這個(gè)api函數(shù)正和我意。先粘來函數(shù)在MSDN上的介紹。

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.

       不是很難,但看完也夠麻煩的了。大致意思就是說,timeGetTime這個(gè)函數(shù),記錄的是從windows開機(jī)到現(xiàn)在經(jīng)歷的時(shí)間,單位為毫秒。函數(shù)返回值為DWORD,即雙字,所以范圍為0-2^32。這個(gè)函數(shù)沒有參數(shù)。聲明的話,在VB中可以用API瀏覽器直接復(fù)制就ok了。

      Private Declare Function timeGetTime Lib "winmm.dll" () As Long

    使用很簡單,只是要注意的是,不要直接用它的返回值參加計(jì)算。這樣很容易出問題,最好使用兩次函數(shù)調(diào)用返回值的差值參與計(jì)算。在WIN NT中,他默認(rèn)的精度是5毫秒。如果你要使精度更高些,就要用timeBeginPeriod 和timeEndPeriod函數(shù)。如果要求在更高要求的環(huán)境下測度時(shí)間間隔就要用QueryPerformanceCounter 和QueryPerformanceFrequency兩個(gè)函數(shù)了。具體用法參考相關(guān)資料。
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP