📄 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 + -