C++_格式化输出时分秒

#include<time.h>
#include   <fstream> 
#include   <string> 
#include <iostream>
using namespace std;//cout

time_t now = time(0);
tm ltm;

now = time(0);
localtime_s(&ltm, &now);

printf("%d:%d:%d#收到触发信号\n", ltm.tm_hour, ltm.tm_min, ltm.tm_sec);

猜你喜欢

转载自blog.csdn.net/qq_36917144/article/details/122376239