網(wǎng)絡營銷以什么為中心官網(wǎng)seo哪家公司好
簡介
time.h 頭文件定義了四個變量類型、兩個宏和各種操作日期和時間的函數(shù)。
庫變量
下面是頭文件 time.h 中定義的變量類型:
序號 | 變量 & 描述 |
---|---|
1 | size_t是無符號整數(shù)類型,它是 sizeof 關鍵字的結果。 |
2 | clock_t這是一個適合存儲處理器時間的類型。 |
3 | time_t is這是一個適合存儲日歷時間的類型。 |
4 | struct tm這是一個用來保存時間和日期的結構。 |
tm 結構的定義如下:
struct tm {int tm_sec; /* 秒,范圍從 0 到 59 */int tm_min; /* 分,范圍從 0 到 59 */int tm_hour; /* 小時,范圍從 0 到 23 */int tm_mday; /* 一月中的第幾天,范圍從 1 到 31 */int tm_mon; /* 月,范圍從 0 到 11 */int tm_year; /* 自 1900 年起的年數(shù) */int tm_wday; /* 一周中的第幾天,范圍從 0 到 6 */int tm_yday; /* 一年中的第幾天,范圍從 0 到 365 */int tm_isdst; /* 夏令時 */
};
庫宏
下面是頭文件 time.h 中定義的宏:
序號 | 宏 & 描述 |
---|---|
1 | NULL這個宏是一個空指針常量的值。 |
2 | CLOCKS_PER_SEC這個宏表示每秒的處理器時鐘個數(shù)。 |
庫函數(shù)
下面是頭文件 time.h 中定義的函數(shù):
序號 | 函數(shù) & 描述 |
---|---|
1 | char *asctime(const struct tm *timeptr)返回一個指向字符串的指針,它代表了結構 timeptr 的日期和時間。 |
2 | clock_t clock(void)返回程序執(zhí)行起(一般為程序的開頭),處理器時鐘所使用的時間。 |
3 | char *ctime(const time_t *timer)返回一個表示當?shù)貢r間的字符串,當?shù)貢r間是基于參數(shù) timer。 |
4 | double difftime(time_t time1, time_t time2)返回 time1 和 time2 之間相差的秒數(shù) (time1-time2)。 |
5 | struct tm *gmtime(const time_t *timer)timer 的值被分解為 tm 結構,并用協(xié)調(diào)世界時(UTC)也被稱為格林尼治標準時間(GMT)表示。 |
6 | struct tm *localtime(const time_t *timer)timer 的值被分解為 tm 結構,并用本地時區(qū)表示。 |
7 | time_t mktime(struct tm *timeptr)把 timeptr 所指向的結構轉(zhuǎn)換為一個依據(jù)本地時區(qū)的 time_t 值。 |
8 | size_t strftime(char *str, size_t maxsize, const char *format, const struct tm *timeptr)根據(jù) format 中定義的格式化規(guī)則,格式化結構 timeptr 表示的時間,并把它存儲在 str 中。 |
9 | time_t time(time_t *timer)計算當前日歷時間,并把它編碼成 time_t 格式。 |