Geom Software - C++ Programming and Geometry Libraries
WOF Documentation pages v1.04
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 
27 class TimerC
28 {
29 public:
34  TimerC():
35  t0(std::chrono::high_resolution_clock::now()),
36  elapsedSeconds(0.0),
37  bStopped(false)
38  {}
43  double stop()
44  {
45  bStopped=true;
46  elapsedSeconds = std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - t0).count();
47  return elapsedSeconds;
48  }
55  double get() const
56  {
57  if(bStopped)
58  {
59  return elapsedSeconds;
60  }
61  else
62  {
63  return std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - t0).count();
64  }
65 
66  }
67 private:
68  std::chrono::high_resolution_clock::time_point t0;
69  double elapsedSeconds;
70  bool bStopped;
71 };
72 
73 
74 
75 
76 } // Namespace
TimerC()
Constructor.
Definition: TimerC.h:34
double stop()
Timer stop.
Definition: TimerC.h:43
Definition: Point3.h:23
Timer class.
Definition: TimerC.h:27