tcal.cpp

来自「Microsoft WinCE 6.0 BSP FINAL release so」· C++ 代码 · 共 32 行

CPP
32
字号
// TCAL.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#define CAL_TIME_MSEC   30000       // 30 sec calibration interval

int _tmain(int argc, TCHAR *argv[], TCHAR *envp[])
{
    SYSTEMTIME sysTime;
    DWORD baseTickCount, tickCount, baseIdleCount, idleCount;
    int i;

    _tprintf(_T("Starting timer calibration.  Time message will be sent every %d sec.\r\n"), CAL_TIME_MSEC/1000);
        
    for (i = 0; i < 10; i++)
    {
        baseTickCount = GetTickCount();
        baseIdleCount = GetIdleTime();
        Sleep(CAL_TIME_MSEC);
        GetSystemTime(&sysTime);
        tickCount = GetTickCount();
        idleCount = GetIdleTime();
        _tprintf(_T("Time = %u:%02u:%02u    CurMSec = %u    Idle = %d%%\r\n\r\n"), 
            sysTime.wHour, sysTime.wMinute, sysTime.wSecond, tickCount,
            (100 * (idleCount - baseIdleCount)) / (tickCount - baseTickCount));
    }

    return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?