// checkTime.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "windows.h" #include "time.h" #include #include #include #include #include // DWORD WINAPI GetTickCount(void); static char * GetTimeString() { SYSTEMTIME st; GetLocalTime(&st); static char to[100]; sprintf (to,"%d-%02d-%02d %02d:%02d:%02d.%03d", (int)st.wYear, (int)st.wMonth,(int)st.wDay,(int)st.wHour, (int)st.wMinute,(int)st.wSecond,(int) st.wMilliseconds); return to; } int _tmain(int argc, _TCHAR* argv[]) { DWORD lastTime=GetTickCount(); DWORD actTime; DWORD diff; LONGLONG g_Frequency, g_CurrentCount, g_LastCount; //Frequenz holen if (!QueryPerformanceFrequency((LARGE_INTEGER*)&g_Frequency)) printf("PerformanceCounter nicht vorhanden\n"); printf("Frequency: %llx\n", g_Frequency); QueryPerformanceCounter((LARGE_INTEGER*)&g_LastCount); long overflow=0xFFFFFFFF / g_Frequency; printf("%s\n",GetTimeString()); printf ("Overflow from lower part are %ld seconds\n",overflow); printf ("ActTime=%lx\n",lastTime); printf ("ActPerfTime=%llx\n",g_LastCount); for (;;) { Sleep(1000); actTime=GetTickCount(); diff = actTime-lastTime; if (diff> 2000) { printf("%s: Error %ld\n", GetTimeString(), diff); printf ("ActTime=%lx\n",actTime); } lastTime=actTime; QueryPerformanceCounter((LARGE_INTEGER*)&g_CurrentCount); double dTimeDiff = (((double)(g_CurrentCount-g_LastCount))/((double)g_Frequency)); if (dTimeDiff> 2 || dTimeDiff < 0) { printf("%s: PerfError %f\n", GetTimeString(), dTimeDiff); printf ("ActPerfTime=%llx\n",g_CurrentCount); } g_LastCount=g_CurrentCount; } return 0; }

AltStyle によって変換されたページ (->オリジナル) /