time.h 的函數 time() 回傳日曆時間,也就是自 1970 年 1 月 1 日後經過的總秒數。
#include <stdio.h>#include <time.h>int main(void){ time_t t1 = time(NULL); printf("自 1970 年 1 月 1 日後經過了 %d 秒....\n", t1); return 0;}
結果印出
自 1970 年 1 月 1 日後經過了 1278481000 秒....
文章標籤
全站熱搜