在开发过程中,难免要对程序的效率进行检测,这时就要统计程序的运行时间,下面代码给出了c++中如何输出当前的时间
int get_time() { time_t time_seconds = time(0); struct tm now_time; localtime_s(&now_time, &time_seconds); std::cout << “current time: “; PRintf(“%d-%d-%d %d:%d:%d/n”, now_time.tm_year + 1900, now_time.tm_mon + 1, now_time.tm_mday, now_time.tm_hour, now_time.tm_min, now_time.tm_sec); return 0; }
新闻热点
疑难解答
图片精选