標準ライブラリヘッダ <ctime>
提供: cppreference.com
このヘッダは元々 C 標準ライブラリに <time.h>
として存在していました。
このヘッダは C スタイルの日付と時間のライブラリの一部です。
目次 |
[編集] マクロ定数
1秒あたりのプロセッサクロックティック数 (マクロ定数) | |
処理系定義のヌルポインタ定数 (マクロ定数) |
[編集] 型
プロセスの実行時間 (typedef) | |
sizeof 演算子によって返される符号なし整数型 (typedef) | |
エポックからの経過時間を表す型 (typedef) | |
カレンダー時刻を表す型 (クラス) | |
(C++17) |
時間を秒とナノ秒で表す型 (構造体) |
[編集] 関数
時間操作 | |
プログラムが開始されてから経過した生のプロセッサクロック時間を返します (関数) | |
現在のシステム時刻をエポックからの経過時間として返します (関数) | |
時刻の差を計算します (関数) | |
(C++17) |
指定されたタイムベースにおけるカレンダー時刻を返します (関数) |
フォーマット変換 | |
time_t オブジェクトをテキスト表現に変換します (関数) | |
tm オブジェクトをテキスト表現に変換します (関数) | |
tm オブジェクトをカスタムテキスト表現に変換します (関数) | |
tm オブジェクトをカスタムテキスト表現のワイド文字列に変換します (関数) | |
エポックからの経過時間を協定世界時で表されるカレンダー時刻に変換します (関数) | |
エポックからの経過時間を現地時間で表されるカレンダー時刻に変換します (関数) | |
カレンダー時刻をエポックからの経過時間に変換します (関数) |
[編集] 概要
#define NULL /* see definition */ #define CLOCKS_PER_SEC /* see definition */ #define TIME_UTC /* see definition */ namespace std { using size_t = /* see definition */; using clock_t = /* see definition */; using time_t = /* see definition */; struct timespec; struct tm; clock_t clock(); double difftime(time_t time1, time_t time0); time_t mktime(struct tm* timeptr); time_t time(time_t* timer); int timespec_get(timespec* ts, int base); char* asctime(const struct tm* timeptr); char* ctime(const time_t* timer); struct tm* gmtime(const time_t* timer); struct tm* localtime(const time_t* timer); size_t strftime(char* s, size_t maxsize, const char* format, const struct 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; };