• <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)

            鏈接

            最新隨筆

            搜索

            最新評論

            香蕉久久夜色精品国产2020| 国产精品99久久久久久人| 亚洲精品高清久久| 色欲综合久久躁天天躁蜜桃| 久久精品成人国产午夜| 久久久久女教师免费一区| 最新久久免费视频| 久久精品无码一区二区WWW| 伊人久久大香线蕉综合影院首页| 国内高清久久久久久| 国内精品久久久久久久久电影网| 99精品久久精品| 亚洲狠狠综合久久| 国产精品丝袜久久久久久不卡| av色综合久久天堂av色综合在| 精品久久久久久综合日本| 97精品伊人久久久大香线蕉| 亚洲国产精品无码久久久久久曰| av国内精品久久久久影院| 狠狠色丁香久久婷婷综合图片 | 色综合久久综合中文综合网| 国产精品久久久久久福利漫画| 狠狠色丁香婷婷久久综合五月| 久久99精品国产99久久6| 国产三级久久久精品麻豆三级| 久久激情五月丁香伊人| 亚洲午夜无码久久久久| 国产亚洲美女精品久久久| 亚洲狠狠婷婷综合久久蜜芽| 四虎久久影院| 亚洲综合婷婷久久| 久久精品国产黑森林| 欧美噜噜久久久XXX| 伊人精品久久久久7777| 久久综合久久综合久久综合| 97久久久久人妻精品专区| 一本久久精品一区二区| 久久高清一级毛片| 一本久久精品一区二区| 久久性精品| 久久91精品国产91久|