C 语言中有关处理系统时间的知识C 语言的标准库函数包括一系列日期和时间处理函数,它们都在头文件中说明,含有三种类型:time_t,struct tm 和 clock_t
定义的 C 语言时间函数原型,如下: time_t time(time_t *timer); double difftime(time_t time1,time_t time2); struct tm *gmtime(const time_t *timer); struct tm *localtime(const time_t *timer); char *asctime(const struct tm *timeptr); char *ctime(const time_t *timer); size_t strftime(char *s,size_t maxsize,const char *format,const struct tm *timeptr); time_t mktime(struct tm *timeptr); clock_t clock(void); 时间函数具有知识和应用:1
asctime〔将时间和日期以字符串格式表示〕 相关函数:time,ctime,gmtime,localtime头文件:#include定义函数:har * asctime(const struct tm * timeptr);函数说明:asctime()将参数 timeptr 所指的 tm 结构中的信息转换成真实世界所使用的时间日期表示方法,然后将结果以字符串形态返回
此函数已经由时区转换成当地时间,字符串格式为:“Wed Jun 30 21:49:08 1993\n〞返回值:返回一字符串表示目前当地的时间日期
附加说明:假设再调用相关的时间日期函数,此字符串可能会被破坏
此函数与 ctime 不同处在于传入