• <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 天下 閱讀(4131) 評論(0)  編輯 收藏 引用 所屬分類: Win32

            <2025年6月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            293012345

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            久久久久人妻一区二区三区| 欧美激情精品久久久久久久九九九| 99久久精品免费观看国产| 人妻少妇久久中文字幕| 久久天天躁狠狠躁夜夜网站| 亚洲AV无码久久精品狠狠爱浪潮| 久久国产精品99国产精| 99久久精品费精品国产一区二区| 久久99国产精品久久久| 久久久中文字幕日本| 亚洲国产精品18久久久久久| 国产精品18久久久久久vr| 久久久久香蕉视频| 国产精品女同久久久久电影院| 久久久艹| 亚洲嫩草影院久久精品| 中文字幕无码久久人妻| 久久精品成人免费看| 伊人久久大香线蕉亚洲五月天 | 精品国产乱码久久久久久呢| 男女久久久国产一区二区三区| 亚洲午夜久久影院| 久久99精品久久久久婷婷| 久久久久久久亚洲精品| 国产精品福利一区二区久久| 精品熟女少妇AV免费久久| 亚洲&#228;v永久无码精品天堂久久 | 国产91久久综合| 久久天堂AV综合合色蜜桃网 | 久久久久无码国产精品不卡| AV无码久久久久不卡蜜桃| 久久精品视频一| 久久久免费观成人影院| 2020最新久久久视精品爱 | 久久嫩草影院免费看夜色| 成人国内精品久久久久影院| 亚洲午夜久久久久久噜噜噜| 久久久久av无码免费网 | AV色综合久久天堂AV色综合在| 亚洲国产另类久久久精品| 久久亚洲熟女cc98cm|