名前空間
変種
操作

標準ライブラリヘッダー <ctime>

From cppreference.com
 
 
標準ライブラリヘッダー
アルゴリズム
<algorithm>
<numeric>
文字列
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
テキスト処理
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
数値
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
時間
<chrono> (C++11)
<ctime>
C互換
<ccomplex> (C++11/17/20*)
<ciso646> (C++20 まで)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

このヘッダーは元々C標準ライブラリの <time.h> でした。

このヘッダーは Cスタイルの日付と時刻 ライブラリの一部です。

目次

マクロ定数

1秒あたりのプロセッサクロックティック数
(マクロ定数) [編集]
処理系定義のヌルポインタ定数
(マクロ定数) [編集]

プロセス実行時間
(typedef) [編集]
sizeof 演算子が返す符号無し整数型
(typedef) [編集]
エポックからの経過時刻型
(typedef) [編集]
カレンダー時間型
(クラス) [編集]
(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;
};
English 日本語 中文(简体) 中文(繁體)