#include
#include
int main()
{
SYSTEMTIME stBeginTime;
SYSTEMTIME stEndTime;
ZeroMemory(&stBeginTime, sizeof(SYSTEMTIME));
ZeroMemory(&stEndTime, sizeof(SYSTEMTIME));
GetSystemTime(&stBeginTime);
/************************************************************************/
/*
Execute the main code
*/
/************************************************************************/
GetSystemTime(&stEndTime);
//the unit is second
DWORD dwSpareTime = (stEndTime.wHour - stBeginTime.wHour) * 60 * 60 * 1000;
dwSpareTime += (stEndTime.wMinute - stBeginTime.wMinute) * 60 * 1000;
dwSpareTime += (stEndTime.wSecond - stBeginTime.wSecond) * 1000;
dwSpareTime += stEndTime.wMilliseconds - stBeginTime.wMilliseconds;
cout < < "The Executing time is " < < dwSpareTime < < " Milliseconds " < < endl;
return 0;
}