Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Thiago Santini
EyeRecToo
Commits
957eb9a9
Commit
957eb9a9
authored
Jan 16, 2019
by
Thiago Santini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds missing file
parent
513c2640
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
EyeRecToo/src/MonotonicClock.h
EyeRecToo/src/MonotonicClock.h
+34
-0
No files found.
EyeRecToo/src/MonotonicClock.h
0 → 100644
View file @
957eb9a9
#ifndef MONOTONICCLOCK_H
#define MONOTONICCLOCK_H
#include <chrono>
using
Timestamp
=
double
;
using
SteadyTimePoint
=
std
::
chrono
::
time_point
<
std
::
chrono
::
steady_clock
>
;
class
MonotonicClock
{
public:
MonotonicClock
()
:
started
(
now
())
{
}
static
SteadyTimePoint
now
()
{
return
std
::
chrono
::
steady_clock
::
now
();
}
Timestamp
elapsed
()
const
{
return
1e-6
*
std
::
chrono
::
duration_cast
<
std
::
chrono
::
nanoseconds
>
(
now
()
-
started
).
count
();
}
Timestamp
elapsed
(
const
SteadyTimePoint
&
p
)
const
{
return
1e-6
*
std
::
chrono
::
duration_cast
<
std
::
chrono
::
nanoseconds
>
(
p
-
started
).
count
();
}
private:
const
SteadyTimePoint
started
;
};
using
ReferenceClock
=
MonotonicClock
;
#endif // MONOTONICCLOCK_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment