|
tools
|
時刻・時間ユーティリティ [詳解]
#include <string>#include <ctime>#include <sstream>#include <iomanip>#include <array>#include <chrono>#include <thread>列挙型 | |
| enum class | tu { n , c , l , s , m , h , d , o , y } |
| 時間単位を表す列挙型 [詳解] | |
関数 | |
| void | sleepc (tu unit, double value) |
| 指定した時間単位でスレッドをスリープさせる | |
| std::string | getCTime (const std::string format) |
| 現在のローカル時刻を指定フォーマットの文字列で返す | |
| int64_t | getUnixTime () |
| 現在の Unix タイムスタンプ(秒)を返す | |
| int | getCTime (const tu unit) |
| 指定した時間単位の現在値をローカル時刻から返す | |
| std::array< int, 3 > | splitTime (int total_seconds) |
| 秒数を 時間・分・秒 の配列に分割する | |
時刻・時間ユーティリティ
時間単位の列挙型 (tu)、スリープ関数、現在時刻の取得・フォーマット、 Unix タイムスタンプ取得、秒数を時分秒に分割する関数を提供します。
time.h に定義があります。
|
strong |
時間単位を表す列挙型
sleepc() や getCTime() などの時間関数に渡す単位を指定します。
| 列挙値 | |
|---|---|
| n | ナノ秒 |
| c | マイクロ秒 |
| l | ミリ秒 |
| s | 秒 |
| m | 分 |
| h | 時間 |
| d | 日 |
| o | 月 |
| y | 年 |
|
inline |
|
inline |
|
inline |
|
inline |