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

            鏈接

            最新隨筆

            搜索

            最新評論

            69久久夜色精品国产69| 国产精品成人久久久| 色综合久久久久无码专区| 久久久噜噜噜久久中文福利| 国产综合久久久久久鬼色| 国产精品VIDEOSSEX久久发布| 人妻精品久久久久中文字幕一冢本| 色欲综合久久躁天天躁蜜桃| 国产精品免费久久| av色综合久久天堂av色综合在| 国产精品毛片久久久久久久 | 亚洲国产综合久久天堂| 久久精品国产亚洲AV电影 | 欧美一区二区三区久久综| 精品久久久久久久久中文字幕| 手机看片久久高清国产日韩| 国产Av激情久久无码天堂| 久久人妻无码中文字幕| 18岁日韩内射颜射午夜久久成人| 国产亚洲美女精品久久久2020| 日本精品久久久久中文字幕8| 久久亚洲AV无码精品色午夜麻豆 | 久久精品水蜜桃av综合天堂| 欧美国产精品久久高清| 国产AⅤ精品一区二区三区久久| 亚洲级αV无码毛片久久精品 | 精品免费久久久久久久| 久久久无码精品亚洲日韩京东传媒 | 国产精品99久久99久久久| 久久精品国产亚洲av麻豆蜜芽| 久久九色综合九色99伊人| 久久综合综合久久狠狠狠97色88| 久久综合精品国产二区无码| 亚洲精品乱码久久久久久按摩 | 麻豆国内精品久久久久久| 91亚洲国产成人久久精品网址| 国产精品久久毛片完整版| 久久99亚洲网美利坚合众国| 国内精品久久久人妻中文字幕| 久久婷婷成人综合色综合| 新狼窝色AV性久久久久久|