time_t
time_t
time()
ライブラリ<time.h>
ヘッダファイルでtypedefによってtime_t
を
UNIXとPOSIXtime_t
time_t
はtime_t
を64ビットの
ISO Cでは、time()
time_t
の
利用 例
#include <stdio.h>
#include <time.h>
/*
* The result should look something like
* Fri 2008-08-22 15:21:59 WAST
*/
int main(void)
{
time_t now;
struct tm *ts;
char buf[80];
// Get the current time
now = time(NULL);
// Format and print the time, "ddd yyyy-mm-dd hh:mm:ss zzz"
ts = localtime(&now);
strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", ts);
printf("%s\n", buf);
printf("%lld\n", (long long)now);
return 0;
}
time_tパーティ
UNIXファンは、UNIX
これらの
2001
2005
2009
2033
脚注
- ^ The Year 2038 problem, Roger M. Wilcox. Retrieved on 2008
年 5月19日 .