標準庫標頭檔案 <ctime>
來自 cppreference.com
此標頭檔案最初在 C 標準庫中為 <time.h>。
此標頭檔案是 C 風格日期和時間庫的一部分。
宏常量 | ||
每秒的處理器時鐘節拍數 (宏常量) | ||
實現定義的空指標常量 (宏常量) | ||
型別 | ||
程序執行時間 (typedef) | ||
由 sizeof 運算子返回的無符號整型 (typedef) | ||
自紀元以來的時間型別 (typedef) | ||
日曆時間型別 (類) | ||
(C++17) |
秒和納秒時間 (結構體) | |
函式 | ||
時間操作 | ||
返回程式啟動以來原始處理器時鐘時間 (函式) | ||
返回系統當前時間,作為自紀元以來的時間 (函式) | ||
計算時間差 (函式) | ||
(C++17) |
根據給定時間基準返回以秒和納秒錶示的日曆時間 (函式) | |
格式轉換 | ||
將 std::time_t 物件轉換為文字表示 (函式) | ||
將 std::tm 物件轉換為文字表示 (函式) | ||
將 std::tm 物件轉換為自定義文字表示 (函式) | ||
將自紀元以來的時間轉換為以世界協調時間表示的日曆時間 (函式) | ||
將自紀元以來的時間轉換為以本地時間表示的日曆時間 (函式) | ||
將日曆時間轉換為自紀元以來的時間 (函式) |
[編輯] 概要
#define NULL /* see description */ #define CLOCKS_PER_SEC /* see description */ #define TIME_UTC /* see description */ namespace std { using size_t = /* see description */; using clock_t = /* see description */; using time_t = /* see description */; struct timespec; struct tm; clock_t clock(); double difftime(time_t time1, time_t time0); time_t mktime(tm* timeptr); time_t time(time_t* timer); int timespec_get(timespec* ts, int base); char* asctime(const tm* timeptr); char* ctime(const time_t* timer); tm* gmtime(const time_t* timer); tm* localtime(const time_t* timer); size_t strftime(char* s, size_t maxsize, const char* format, const tm* timeptr); }
[編輯] 類 std::timespec
struct timespec { std::time_t tv_sec; long tv_nsec; };
[編輯] 類 std::tm
struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; };