在windows上寫c如下
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void){
time_t t1,t2; // typedef time_t long;
t1 = time(NULL);
Sleep(1234);
t2 = time(NULL);
printf("%ld secs\n",t2-t1);
system("pause");
return 0;
}
可顯示執行這程式的時間約 2 sec。
請問在linux上該怎麼寫呢?
--
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void){
time_t t1,t2; // typedef time_t long;
t1 = time(NULL);
Sleep(1234);
t2 = time(NULL);
printf("%ld secs\n",t2-t1);
system("pause");
return 0;
}
可顯示執行這程式的時間約 2 sec。
請問在linux上該怎麼寫呢?
--
All Comments