1、静态函数
std::string Config::getCurTimeStr() { std::string ret; time_t timep; struct tm *p; time(&timep); p = localtime(&timep); printf(" ", 1900 + p->tm_year, 1+ p->tm_mon, p->tm_mday,p->tm_hour, p->tm_min, p->tm_sec); std::ostringstream buffer; buffer << 1900 + p->tm_year << 1 + p->tm_mon << p->tm_mday << p->tm_hour << p->tm_min << p->tm_sec; ret = buffer.str(); return ret; }
2、宏定义
#define zout std::cout<<std::endl<<Config::getCurTimeStr()<<"-> "