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

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

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            97精品伊人久久久大香线蕉 | 人人狠狠综合久久亚洲88| 亚洲国产成人久久综合碰| 精品久久人人做人人爽综合| 99re这里只有精品热久久| 久久国产亚洲高清观看| 久久精品亚洲日本波多野结衣| 一本色道久久88精品综合| 午夜精品久久久久久中宇| 欧美va久久久噜噜噜久久| 久久婷婷五月综合国产尤物app| 国产精品18久久久久久vr| 国产成人精品久久一区二区三区 | 久久久久久亚洲精品无码| 久久无码人妻精品一区二区三区 | 99国产欧美久久久精品蜜芽 | 香蕉99久久国产综合精品宅男自 | 国产午夜精品久久久久免费视| 老色鬼久久亚洲AV综合| 久久亚洲欧美日本精品| 无码任你躁久久久久久久| 久久99久久99精品免视看动漫| 99久久国产精品免费一区二区| 99久久国产综合精品麻豆| 国产精品九九久久免费视频| 久久青青国产| 一本大道久久a久久精品综合| 综合久久精品色| 国产成人久久激情91| 国产精品久久久久久久人人看| 国产精品美女久久久久| 一本大道久久香蕉成人网| 国产产无码乱码精品久久鸭| 久久婷婷五月综合97色直播 | 一级做a爰片久久毛片16| 久久综合偷偷噜噜噜色| 久久综合丝袜日本网| 亚洲国产精品无码久久98| 久久久久亚洲av毛片大| 久久国产精品成人免费| 色综合久久无码五十路人妻|