如何在linux上寫執行時間的程式? - Linux

By Jake
at 2011-09-09T03:01
at 2011-09-09T03:01
Table of Contents
※ 引述《spiderman007 (千里之外)》之銘言:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#ifdef _WIN32_
#include <windows.h>
#else
#include <unistd.h>
#define Sleep(a) usleep(a*1000)
#endif
int main(void){
time_t t1,t2; // typedef time_t long;
t1 = time(0);
Sleep(1234);
t2 = time(0);
printf("%ld secs\n",t2-t1);
gtc(stdin);
return 0;
}
--
~~於是,銀河的歷史又被海賊抹黑了好幾百頁。
咦?的歷史又被抹黑了好幾百頁!?
- A23203 -
BM4GRM Harlock WolfLord
★ <<上站通知>> -- 我來啦!
--
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#ifdef _WIN32_
#include <windows.h>
#else
#include <unistd.h>
#define Sleep(a) usleep(a*1000)
#endif
int main(void){
time_t t1,t2; // typedef time_t long;
t1 = time(0);
Sleep(1234);
t2 = time(0);
printf("%ld secs\n",t2-t1);
gtc(stdin);
return 0;
}
--
~~於是,銀河的歷史又被海賊抹黑了好幾百頁。
咦?的歷史又被抹黑了好幾百頁!?
- A23203 -
BM4GRM Harlock WolfLord
★ <<上站通知>> -- 我來啦!
--
Tags:
Linux
All Comments

By Bethany
at 2011-09-10T11:32
at 2011-09-10T11:32

By Genevieve
at 2011-09-12T11:02
at 2011-09-12T11:02
Related Posts
9/15、9/17 Linux 核心軟中斷實作-對照BSD之設計技術研討會

By Heather
at 2011-09-08T18:56
at 2011-09-08T18:56
找不到網路介面

By Andrew
at 2011-09-08T17:41
at 2011-09-08T17:41
Ubuntu寫C

By Oscar
at 2011-09-08T17:18
at 2011-09-08T17:18
RE:SSD磁柱分配方式

By Isabella
at 2011-09-08T16:02
at 2011-09-08T16:02
mount iso scripts 抓錯

By Joe
at 2011-09-08T10:23
at 2011-09-08T10:23