#include <iostream>
#include <time.h>
using namespace std;
int main() {
clock_t start, finish;
double totaltime;
start = clock();
time_t new_cur_time = time(NULL);
struct tm p_time;
localtime_r(&new_cur_time, &p_time);
static const int SIZE = 20;
char new_en_time[SIZE] = {0};
strftime(new_en_time, SIZE, "%Y-%m-%d %H:%M:%S", &p_time); // 格式化当前时间
cout << "当前时间为:" << new_en_time << endl;
finish = clock();
totaltime = (double)(finish-start)/CLOCKS_PER_SEC;
cout << "此程序的运行时间为:" << totaltime << "秒!" << endl;
}