stopwatch.py
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 import time
4 
5 # Timer that counts forward in time (vs backwards in the 'timer' class)
6 # It supply a basic stopwatch API, reset, get elapsed time..
7 class Stopwatch:
8 
9  _start = 0
10 
11  def __init__(self):
12  self._start = time.perf_counter()
13 
14  # Reset the stopwatch time
15  def reset(self, new_start_time = None):
16  if new_start_time:
17  self._start = new_start_time
18  else:
19  self._start = time.perf_counter()
20 
21  # Get elapsed since timer creation
22  def get_elapsed(self):
23  return time.perf_counter() - self._start
24 
25  # Get stopwatch start time
26  def get_start(self):
27  return self._start
28 
def reset(self, new_start_time=None)
Definition: stopwatch.py:15


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:11