DSP

通过头文件 time.h中的接口获取系统当前时间的方法

2019-07-13 16:49发布

#include 82 struct tm *t; 83 time_t tt; 84 time_t ts; 85 86 struct tm tr = {0}; 87 88 time(&tt); 89 t = localtime(&tt); 90 printf("localtime %4d%02d%02d %02d:%02d:%02d ", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);