Geom Software - C++ Programming and Geometry Libraries
FADEPLACEHOLDER Documentation pages v1.03
TimerC.h
1 // Copyright (C) Geom Software e.U, Bernhard Kornberger, Graz/Austria
2 //
3 // This file is part of the WOF software. WOF is commercial software.
4 // Users holding a license may use this file in accordance with the
5 // License Agreement.
6 //
7 // This software is provided AS IS with NO WARRANTY OF ANY KIND,
8 // INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
9 // FOR A PARTICULAR PURPOSE.
10 //
11 // Please contact the author if any conditions of this licensing are
12 // not clear to you.
13 //
14 // Author: Bernhard Kornberger, bkorn (at) geom.at
15 // http://www.geom.at
16 
17 #pragma once
18 #include <chrono>
19 
20 
21 namespace GEOM_WOF {
22 
25 class TimerC
26 {
27 public:
32  TimerC():
33  t0(std::chrono::high_resolution_clock::now()),
34  elapsedSeconds(0.0),
35  bStopped(false)
36  {}
41  double stop()
42  {
43  bStopped=true;
44  elapsedSeconds = std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - t0).count();
45  return elapsedSeconds;
46  }
53  double get() const
54  {
55  if(bStopped)
56  {
57  return elapsedSeconds;
58  }
59  else
60  {
61  return std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - t0).count();
62  }
63 
64  }
65 private:
66  std::chrono::high_resolution_clock::time_point t0;
67  double elapsedSeconds;
68  bool bStopped;
69 };
70 
71 
72 
73 
74 } // Namespace
TimerC()
Constructor.
Definition: TimerC.h:32
double stop()
Timer stop.
Definition: TimerC.h:41
Definition: Point3.h:23
Timer class.
Definition: TimerC.h:25