Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
common
utilities
time
timer.h
Go to the documentation of this file.
1
// License: Apache 2.0. See LICENSE file in root directory.
2
// Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3
4
// Helper classes to keep track of time
5
#pragma once
6
7
#include "
stopwatch.h
"
8
9
namespace
utilities
10
{
11
namespace
time
12
{
13
// A timer counting backwards in time (vs forwards in the `stopwatch` class)
14
// It supply basic timer API, start, has_expired..
15
class
timer
16
{
17
public
:
18
19
timer
(clock::duration
timeout
) :
_delta
(timeout),
sw
()
20
{
21
}
22
23
// Start timer
24
void
start
()
const
25
{
26
sw
.
reset
();
27
}
28
29
// Check if timer time expired
30
bool
has_expired
()
const
31
{
32
return
sw
.
get_start
() +
_delta
<=
clock::now
();
33
}
34
35
// Force time expiration
36
void
set_expired
()
37
{
38
sw
.
reset
(
clock::now
() - (
_delta
+
std::chrono::nanoseconds
(100)));
39
}
40
protected
:
41
clock::duration
_delta
;
42
stopwatch
sw
;
43
};
44
}
45
}
opencv_pointcloud_viewer.now
now
Definition:
opencv_pointcloud_viewer.py:302
utilities::time::stopwatch
Definition:
stopwatch.h:14
utilities::time::timer::start
void start() const
Definition:
timer.h:24
utilities::time::timer::set_expired
void set_expired()
Definition:
timer.h:36
stopwatch.h
utilities::time::timer::sw
stopwatch sw
Definition:
timer.h:42
utilities::time::timer::timer
timer(clock::duration timeout)
Definition:
timer.h:19
utilities::time::stopwatch::get_start
clock::time_point get_start() const
Definition:
stopwatch.h:42
utilities::time::stopwatch::reset
void reset(clock::time_point start_time=clock::now()) const
Definition:
stopwatch.h:24
utilities::time::timer
Definition:
timer.h:15
utilities::time::timer::has_expired
bool has_expired() const
Definition:
timer.h:30
librealsense::device_serializer::nanoseconds
std::chrono::duration< uint64_t, std::nano > nanoseconds
Definition:
src/core/serialization.h:46
utilities::time::timer::_delta
clock::duration _delta
Definition:
timer.h:41
timeout
GLbitfield GLuint64 timeout
Definition:
glad/glad/glad.h:3385
utilities
Definition:
wrap.cpp:11
librealsense2
Author(s): Sergey Dorodnicov
, Doron Hirshberg
, Mark Horn
, Reagan Lopez
, Itay Carpis
autogenerated on Mon May 3 2021 02:50:11