Chi-Tech
chi_timer.h
Go to the documentation of this file.
1
#ifndef CHI_TIMER_H
2
#define CHI_TIMER_H
3
4
#include <string>
5
#include <chrono>
6
7
8
//################################################################### CLASS DEF
9
namespace
chi
10
{
11
/** Timer object.*/
12
class
Timer
13
{
14
private
:
15
std::chrono::steady_clock::time_point
start_time_
;
16
17
public
:
18
//00
19
Timer
() noexcept;
20
//01
21
void
Reset
();
22
double
GetTime
() const;
23
std::
string
GetTimeString
() const;
24
static std::
string
GetLocalDateTimeString
();
25
};
26
27
/**Puts the current thread to sleep.
28
* \param time Time to sleep for.
29
*
30
* \note To specify different times `std::chrono` allows
31
* you to change the unit with, e.g.,
32
* `chi::Sleep(std::chrono::milliseconds(100))` sleeps for 100 milliseconds,
33
* `std::Sleep(std::chrono::seconds(1))` sleeps for 1 second.*/
34
void
Sleep
(std::chrono::duration<
double
> time);
35
}
36
37
#endif
38
chi::Timer
Definition:
chi_timer.h:13
chi::Timer::Reset
void Reset()
Definition:
chi_timer.cc:16
chi::Timer::GetTime
double GetTime() const
Definition:
chi_timer.cc:23
chi::Timer::GetLocalDateTimeString
static std::string GetLocalDateTimeString()
Definition:
chi_timer.cc:55
chi::Timer::GetTimeString
std::string GetTimeString() const
Definition:
chi_timer.cc:38
chi::Timer::Timer
Timer() noexcept
Definition:
chi_timer.cc:9
chi::Timer::start_time_
std::chrono::steady_clock::time_point start_time_
Definition:
chi_timer.h:15
chi
Definition:
chi_runtime.h:53
chi::Sleep
void Sleep(std::chrono::duration< double > time)
Definition:
chi_timer.cc:68
framework
utils
chi_timer.h
Generated by
1.9.3