printdate.cc
来自「c++编写的并行拉马克遗传算法的程序。实现分析对接程序」· CC 代码 · 共 46 行
CC
46 行
/* 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 + =
减小字号Ctrl + -
显示快捷键?