这样干,你少写了两行
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf("程序运行开始,Currentlocal time and date: %s\n", asctime(timeinfo));
……
time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf("程序运行结束,Currentlocal time and date: %s", asctime(timeinfo));