?
Dokumen ini menggunakan Manual laman web PHP Cina Lepaskan
在頭文件<time.h>中定義 | ||
---|---|---|
typedef / * unspecified * / time_t; |
C11標(biāo)準(zhǔn)(ISO / IEC 9899:2011):
7.27.2.5 timespec_get函數(shù)(p:390)
盡管沒有用C標(biāo)準(zhǔn)定義,但它幾乎總是一個(gè)整數(shù)值,它保存自1970年1月1日00:00 UTC以來對(duì)應(yīng)于POSIX時(shí)間的秒數(shù)(不包括閏秒)。
當(dāng)引用類型的值時(shí),標(biāo)準(zhǔn)使用術(shù)語日歷時(shí)間time_t
。
顯示時(shí)代的開始。
#include <stdio.h>#include <time.h> int main(void){ time_t epoch = 0; printf("%ld seconds since the epoch began\n", (long)epoch); printf("%s", asctime(gmtime(&epoch)));}
可能的輸出:
0 seconds since the epoch began Thu Jan 1 00:00:00 1970
C11標(biāo)準(zhǔn)(ISO / IEC 9899:2011):
7.27.1 / 3時(shí)間分量(p:388)
C99標(biāo)準(zhǔn)(ISO / IEC 9899:1999):
7.23.1 / 3時(shí)間的組成部分(p:338)
C89 / C90標(biāo)準(zhǔn)(ISO / IEC 9899:1990):
4.12.1時(shí)間的組成部分