在開發過程中,難免要對程序的效率進行檢測,這時就要統計程序的運行時間,下面代碼給出了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; }
新聞熱點
疑難解答
圖片精選