mal-packet-weaver
C++20 packet serialization/deserialization library.
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
e
f
g
h
i
k
l
m
p
r
s
t
u
w
Functions
a
b
c
f
g
h
i
l
m
p
r
s
t
u
w
Variables
Typedefs
Enumerations
Concepts
Classes
Class List
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
~
Variables
a
c
d
e
f
g
i
j
l
m
n
o
p
r
s
t
u
w
Typedefs
Related Symbols
Files
File List
File Members
All
m
Macros
m
▼
mal-packet-weaver
Todo List
►
Namespaces
►
Concepts
►
Classes
▼
Files
▼
File List
►
mal-packet-weaver
▼
third_party
▼
mal-toolkit
▼
mal-toolkit
▼
mal-toolkit
►
detail
►
include
►
backoffs.hpp
►
byte-helper.hpp
►
callback-system.hpp
►
common-structures.hpp
►
converter.hpp
►
debug.hpp
►
library-pch.hpp
►
macro.hpp
mal-toolkit.hpp
►
measurer.hpp
►
stl-helpers.hpp
►
string.hpp
►
template.hpp
►
timer.hpp
►
uuid.hpp
►
win-utils.hpp
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Concepts
Loading...
Searching...
No Matches
timer.hpp
Go to the documentation of this file.
1
#pragma once
7
namespace
mal_toolkit
8
{
15
template
<
class
clock>
16
class
Timer
17
{
18
public
:
22
Timer
()
23
{
24
current_
= clock::now();
25
reset
();
26
}
22
Timer
() {
…
}
27
31
void
reset_to_now
() {
start_
= clock::now(); }
32
36
void
reset
() {
start_
=
current_
; }
37
43
constexpr
float
elapsed
() noexcept
44
{
45
current_
= clock::now();
46
return
std::chrono::duration_cast<std::chrono::duration<float>>(
current_
-
start_
).count();
47
}
43
constexpr
float
elapsed
() noexcept {
…
}
48
49
private
:
50
std::chrono::time_point<clock>
start_
;
51
std::chrono::time_point<clock>
current_
;
52
};
16
class
Timer
{
…
};
53
57
using
SteadyTimer
=
Timer<std::chrono::steady_clock>
;
58
62
using
HighResolutionTimer
=
Timer<std::chrono::high_resolution_clock>
;
63
64
}
// namespace mal_toolkit
mal_toolkit::Timer
A simple timer class for measuring elapsed time using various clock types.
Definition
timer.hpp:17
mal_toolkit::Timer::start_
std::chrono::time_point< clock > start_
The time point representing the start time.
Definition
timer.hpp:50
mal_toolkit::Timer::elapsed
constexpr float elapsed() noexcept
Calculates and returns the elapsed time since the timer was last reset.
Definition
timer.hpp:43
mal_toolkit::Timer::reset
void reset()
Resets the start time to the previously captured current time.
Definition
timer.hpp:36
mal_toolkit::Timer::Timer
Timer()
Constructs a Timer and initializes it with the current time.
Definition
timer.hpp:22
mal_toolkit::Timer::current_
std::chrono::time_point< clock > current_
The time point representing the current time.
Definition
timer.hpp:51
mal_toolkit::Timer::reset_to_now
void reset_to_now()
Resets the start time to the current time.
Definition
timer.hpp:31
mal_toolkit
Contains a collection of tools and utilities provided by the MAL Toolkit library.
Definition
backoffs.hpp:7
third_party
mal-toolkit
mal-toolkit
mal-toolkit
timer.hpp
Generated on Sun Jul 14 2024 00:02:52 for mal-packet-weaver by
1.11.0