《Linux系统调用:gmtime,mktime,asctime》
生活随笔
收集整理的這篇文章主要介紹了
《Linux系统调用:gmtime,mktime,asctime》
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
一、介紹
#include <time.h>char *asctime(const struct tm *tm);// 將time_t值轉(zhuǎn)換為一個(gè)所謂的分解時(shí)間 struct tm 結(jié)構(gòu)體 struct tm *gmtime(const time_t *timep);// 把分解時(shí)間 struct tm結(jié)構(gòu)體轉(zhuǎn)換為 time_t 值 time_t mktime(struct tm *tm);上面返回值都是錯(cuò)誤-1或者NULL,并且設(shè)置errnostruct tm {int tm_sec; /* Seconds (0-60) */int tm_min; /* Minutes (0-59) */int tm_hour; /* Hours (0-23) */int tm_mday; /* Day of the month (1-31) */int tm_mon; /* Month (0-11) */int tm_year; /* Year - 1900 */int tm_wday; /* Day of the week (0-6, Sunday = 0) */int tm_yday; /* Day in the year (0-365, 1 Jan = 0) */int tm_isdst; /* Daylight saving time */>0 : DTS is in effect=0 : DTS is not effect<0 : DTS information not available };tm_isdst 為0,則將這一時(shí)間視為標(biāo)準(zhǔn)時(shí)刻 tm_isdst 大于0,則將這一時(shí)間視為夏令時(shí) tm_isdst 小于0,總結(jié)
以上是生活随笔為你收集整理的《Linux系统调用:gmtime,mktime,asctime》的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Autonomous Reinforce
- 下一篇: 树莓派2B 3B安装USB无线网卡 ED