Gazebo Math

API Reference

8.0.0
Stopwatch.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17
18#ifndef GZ_MATH_STOPWATCH_HH_
19#define GZ_MATH_STOPWATCH_HH_
20
21#include <chrono>
22#include <gz/math/Export.hh>
23#include <gz/math/config.hh>
24#include <gz/utils/ImplPtr.hh>
25
26namespace gz::math
27{
28 // Use a steady clock
29 // This alias is now deprecated; please use std::chrono::steady_clock
30 // directly instead.
31 using clock
32 [[deprecated("As of 8.0, use std::chrono::steady_clock directly.")]]
34
35 // Inline bracket to help doxygen filtering.
36 inline namespace GZ_MATH_VERSION_NAMESPACE {
59 {
61 public: Stopwatch();
62
67 public: bool Start(const bool _reset = false);
68
73 public: std::chrono::steady_clock::time_point StartTime() const;
74
78 public: bool Stop();
79
84 public: std::chrono::steady_clock::time_point StopTime() const;
85
88 public: bool Running() const;
89
92 public: void Reset();
93
99 public: std::chrono::steady_clock::duration ElapsedRunTime() const;
100
106 public: std::chrono::steady_clock::duration ElapsedStopTime() const;
107
111 public: bool operator==(const Stopwatch &_watch) const;
112
116 public: bool operator!=(const Stopwatch &_watch) const;
117
119 GZ_UTILS_IMPL_PTR(dataPtr)
120 };
121 } // namespace GZ_MATH_VERSION_NAMESPACE
122} // namespace gz::math
123#endif // GZ_MATH_STOPWATCH_HH_