• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            天下

            記錄修行的印記

            GetTickCount()函數

             

            在要求誤差不大于1毫秒的情況下,可以采用GetTickCount()函數,該函數的返回值是DWORD型,表示以毫秒為單位的計算機啟動后經歷的時間間隔。使用下面的編程語句,可以實現50毫秒的精確定時,其誤差小于1毫秒。

            對于一般的實時控制,使用GetTickCount()函數就可以滿足精度要求,但要進一步提高計時精度,就要采用QueryPerformanceFrequency()函數和QueryPerformanceCounter()函數。
            這兩個函數是VC提供的僅供Windows使用的高精度時間函數,并要求計算機從硬件上支持高精度計時器。QueryPerformanceFrequency()函數和QueryPerformanceCounter()函數的原型為:

            The QueryPerformanceFrequency function retrieves the frequency of the high-resolution performance counter, if one exists. The frequency cannot change while the system is running.

            BOOL QueryPerformanceFrequency(         
                LARGE_INTEGER *lpFrequency
            );

            Parameters

            lpFrequency
            [out] Pointer to a variable that receives the current performance-counter frequency, in counts per second. If the installed hardware does not support a high-resolution performance counter, this parameter can be zero.
            Return Value

            If the installed hardware supports a high-resolution performance counter, the return value is nonzero.

            If the function fails, the return value is zero. To get extended error information, call GetLastError. For example, if the installed hardware does not support a high-resolution performance counter, the function fails.


            The QueryPerformanceCounter function retrieves the current value of the high-resolution performance counter.
            BOOL QueryPerformanceCounter(         
                LARGE_INTEGER *lpPerformanceCount
            );
            Parameters

            lpPerformanceCount
            [out] Pointer to a variable that receives the current performance-counter value, in counts.
            Return Value

            If the function succeeds, the return value is nonzero.

            If the function fails, the return value is zero. To get extended error information, call GetLastError.



            Linux下的:

             

            #include <sys/time.h>
            unsigned 
            long GetTickCount()
            {
                
            struct timeval tv;
                
            if (gettimeofday(&tv,NULL) !=0) {
                    
            return 0;    
                }
                
            return (tv.tv_sec*1000)+(tv.tv_usec/1000);
            }

            posted on 2011-03-05 09:50 天下 閱讀(4132) 評論(0)  編輯 收藏 引用 所屬分類: Win32

            <2012年3月>
            26272829123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            少妇被又大又粗又爽毛片久久黑人 | 国产成人精品久久| 久久综合狠狠色综合伊人| 久久97久久97精品免视看| 久久这里只有精品首页| 久久er热视频在这里精品| 久久久久国色AV免费观看| 亚洲精品乱码久久久久66| 91精品免费久久久久久久久| 久久久久一本毛久久久| 伊人久久大香线焦AV综合影院| 色综合久久88色综合天天| 色综合久久久久无码专区| 国产精品成人精品久久久| 亚洲精品乱码久久久久久自慰| 久久综合给合综合久久| 久久精品国产精品亚洲毛片 | 久久久久久国产精品美女| 亚洲色大成网站www久久九 | 久久w5ww成w人免费| 久久精品国产亚洲AV影院| 国产精品成人精品久久久| 999久久久无码国产精品| 日本强好片久久久久久AAA| 热久久国产欧美一区二区精品| A级毛片无码久久精品免费| 99久久综合狠狠综合久久止| 99蜜桃臀久久久欧美精品网站 | 久久久精品日本一区二区三区| 国产一级做a爰片久久毛片| 精品久久8x国产免费观看| 精品熟女少妇AV免费久久| 99精品国产免费久久久久久下载| 久久av高潮av无码av喷吹| 91精品国产综合久久香蕉 | 99久久免费国产特黄| 人妻精品久久久久中文字幕一冢本| 性做久久久久久免费观看| 久久综合狠狠综合久久97色| 久久精品成人免费观看97| 伊人热热久久原色播放www|