Kyopro Library
 
読み取り中…
検索中…
一致する文字列を見つけられません
timer.hpp
[詳解]
1#pragma once
2#include"../../kyopro_library/template.hpp"
3
4/// @brief タイマー
5struct 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
22private:
23 chrono::high_resolution_clock::time_point start;
24 chrono::high_resolution_clock::time_point time_limit;
25};
タイマー
Definition timer.hpp:5
ll get() const
今の時間 msec を返す
Definition timer.hpp:12
Timer(ll time_limit_msec=5000)
Definition timer.hpp:6
bool check() const
今が制限時間内であるかを返す
Definition timer.hpp:18