Kyopro Library
読み取り中…
検索中…
一致する文字列を見つけられません
timer.hpp
[詳解]
1
#
pragma
once
2
#
include
"../../kyopro_library/template.hpp"
3
4
/// @brief タイマー
5
struct
Timer
{
6
Timer
(ll time_limit_msec=5000) {
7
start=chrono::high_resolution_clock::now();
8
time_limit=start+chrono::milliseconds(time_limit_msec);
9
}
10
11
/// @brief 今の時間 msec を返す
12
inline
ll
get
()
const
{
13
auto
now=chrono::high_resolution_clock::now();
14
return
chrono::duration_cast<chrono::milliseconds>(now-start).count();
15
}
16
17
/// @brief 今が制限時間内であるかを返す
18
inline
bool
check
()
const
{
19
return
chrono::high_resolution_clock::now()<time_limit;
20
}
21
22
private
:
23
chrono::high_resolution_clock::time_point start;
24
chrono::high_resolution_clock::time_point time_limit;
25
};
Timer
タイマー
Definition
timer.hpp:5
Timer::get
ll get() const
今の時間 msec を返す
Definition
timer.hpp:12
Timer::Timer
Timer(ll time_limit_msec=5000)
Definition
timer.hpp:6
Timer::check
bool check() const
今が制限時間内であるかを返す
Definition
timer.hpp:18
others
timer.hpp
構築:
1.13.2