Re: [問題] 如何在linux上寫執行時間的程式?
※ 引述《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
09/09 23:22, 1F
→
09/11 11:02, , 2F
09/11 11:02, 2F
討論串 (同標題文章)
完整討論串 (本文為第 3 之 3 篇):