Re: [問題] 如何在linux上寫執行時間的程式?

看板Linux作者 (飛天)時間14年前 (2011/09/09 17:43), 編輯推噓0(002)
留言2則, 2人參與, 最新討論串3/3 (看更多)
※ 引述《spiderman007 (千里之外)》之銘言: 直接寫給你吧: #include <stdio.h> #include <time.h> main(argc, argv) int argc; char *argv[]; { char Transdate[20+1]; long t; struct tm *tp; time(&t); tp=localtime(&t); memset(Transdate, 0x00, sizeof(Transdate)); sprintf(Transdate,"%04d/%02d/%02d",tp->tm_year+1900,tp->tm_mon+1,tp->tm_mday); printf("DATE=[%s]\n",Transdate); } ~ -- 【只要有心,凡是都可以成為可能!!】 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 139.175.255.95 ※ 編輯: TwoDemon 來自: 139.175.255.95 (09/09 17:44)

09/09 23:22, , 1F
strftime(str,"%Y/%m/%d",tp);...
09/09 23:22, 1F

09/11 11:02, , 2F
老實說,我看不懂這個跟原來程式的關係 :P
09/11 11:02, 2F
文章代碼(AID): #1EQT_P2t (Linux)
文章代碼(AID): #1EQT_P2t (Linux)