?? printdate.cc
字號:
/* printdate.cc */#ifdef sgi #include <stdio.h> #include <sys/types.h> #include <sys/time.h> #include <time.h> #include "printdate.h"#else extern "C" { #include <stdio.h> #include <sys/types.h> #include <sys/time.h> #include <time.h> #include "printdate.h" }#endifvoid printdate( FILE *fp, int flag ){ time_t tn; /* tn = "time_now" */ char *StringTimeDate; struct tm *ts; tn = time( &tn ); ts = localtime( &tn ); if (flag==1) { fprintf(fp, "%d:%02d %02d\" %s, %02d/%02d/%02d\n", ( (ts->tm_hour > 12) ? (ts->tm_hour-12) : ts->tm_hour ), ts->tm_min, ts->tm_sec, ( (ts->tm_hour >= 12) ? "p.m." : "a.m." ), (ts->tm_mon + 1), ts->tm_mday, ts->tm_year ); } else if (flag==2) { StringTimeDate = ctime( &tn ); fprintf(fp, "%s", StringTimeDate); } else { fprintf(fp, "%d:%02d %02d\" %s\n", ( (ts->tm_hour > 12) ? (ts->tm_hour-12) : ts->tm_hour ), ts->tm_min, ts->tm_sec, ( (ts->tm_hour >= 12) ? "pm" : "am" ) ); }}/* EOF */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -