#include <stdio.h>
#include <time.h>
#include <windows.h>
using namespace std;
void wait (int seconds);
int main()
{
time_t start, end;
double diff;
time (&start); //useful call
for (int i=0;i<10;i++) //this loop is useless, just to pass some time.
{
printf ("%s\n", ctime(&start));
wait(1);
}
time (&end);//useful call
diff = difftime(end,start);//this will give you time spent between those two calls.
printf("difference in seconds=%f",diff); //convert secs as u like
system("pause");
return 0;
}
void wait (int seconds)
{
clock_t endwait;
endwait = clock() + seconds * CLOCKS_PER_SEC ;
while (clock() < endwait) {}
}
이 Solaris에서 잘 작동합니다/유닉스는 단지 승리의 심판
초마다 이벤트가 필요합니까? 뭔가 업데이트? 또는 프로그램이 실행되는 총 시간은 몇 초입니까? – Dani