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

            <2015年12月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            導航

            統計

            常用鏈接

            留言簿(4)

            隨筆分類(378)

            隨筆檔案(329)

            鏈接

            最新隨筆

            搜索

            最新評論

            久久亚洲国产成人精品性色| 狠狠色丁香婷婷久久综合五月| 久久青草国产精品一区| 精品综合久久久久久97超人| 国内精品久久久久久久coent| 久久久久久久久久久免费精品| 久久精品亚洲AV久久久无码| 国产精品99久久99久久久| 久久中文字幕精品| 国产成人久久久精品二区三区| 欧美久久一区二区三区| 91精品国产综合久久精品| 久久久无码精品午夜| 久久亚洲精品人成综合网 | 国产精品日韩欧美久久综合| 综合久久给合久久狠狠狠97色 | av午夜福利一片免费看久久| 亚洲精品国产综合久久一线| 久久美女人爽女人爽| 亚洲精品无码专区久久久| 亚洲精品无码久久久| 夜夜亚洲天天久久| 激情伊人五月天久久综合| 思思久久精品在热线热| 精品久久久久久国产三级| 91精品国产9l久久久久| 久久亚洲中文字幕精品有坂深雪| 久久亚洲精品国产亚洲老地址 | 色婷婷久久综合中文久久蜜桃av| 一级女性全黄久久生活片免费| 国产成人99久久亚洲综合精品| 久久精品夜夜夜夜夜久久| 无码精品久久久天天影视| 天天影视色香欲综合久久| 久久久久亚洲AV综合波多野结衣| 99精品伊人久久久大香线蕉| 97久久超碰国产精品2021| 精品久久无码中文字幕| 99国产精品久久| 国产精品九九久久精品女同亚洲欧美日韩综合区| 久久久久人妻一区二区三区vr|