#include int xitongshijian(int *i,int *o,int *l) { time_t timep,Tim; struct tm *p; time(&timep); p = localtime(&timep); //此函数获得的tm结构体的时间,是已经进行过时区转化为本地时间 //p = gmtime(&timep); //把日期和时间转换为格林威治(GMT)时间的函数 int Year = 1900 + p->tm_year; int Month = 1 + p->tm_mon; int Day = p->tm_mday; int Hour = p->tm_hour; int Minute = p->tm_min; int Second = p->tm_sec; char year[20]; char month[20]; char day[20]; char hour[20]; char minute[20]; char second[20]; *i=Month;*o=Day;*l=Hour; return 0; }