C++获取本地时间常见方法汇总

einfachnurweg 6 0 PDF 2021-01-16 23:01:55

1.跨平台方法 1.1方法一:手动暴力法 #include using namespace std; #include time_t t = time(NULL); struct tm* stime=localtime(&t); char tmp[32]={NULL}; sprintf(tmp, "d-d-d d:d:d",1900+stime->tm_year,1+stime->tm_mon,stime->tm_mday, stime->tm_hour,stime->tm_min,stime->tm_sec); c

用户评论
请输入评论内容
评分:
暂无评论