MRPT  1.9.9
Clock.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <chrono>
12 
13 namespace mrpt
14 {
15 /** Clock that is compatible with MRPT TTimeStamp representation
16  * \ingroup mrpt_core_grp
17  */
18 class Clock
19 {
20  public:
21  using rep = int64_t;
22  // 100-nanoseconds
23  using period = std::ratio<1, 10000000>;
24  using duration = std::chrono::duration<rep, period>;
25  using time_point = std::chrono::time_point<Clock>;
26 
27  static constexpr bool is_steady = std::chrono::system_clock::is_steady;
28 
29  /** Returns the current time, with the highest resolution available.
30  * Typically this is better than 1 microsecond. */
31  static time_point now() noexcept;
32  /** Create a timestamp from its double representation. \sa toDouble */
33  static time_point fromDouble(const double t) noexcept;
34  /** Converts a timestamp to a UNIX time_t-like number, with fractional part
35  * \sa fromDouble */
36  static double toDouble(const time_point t) noexcept;
37 };
38 } // namespace mrpt
int64_t rep
Definition: Clock.h:21
static double toDouble(const time_point t) noexcept
Converts a timestamp to a UNIX time_t-like number, with fractional part.
Definition: Clock.cpp:58
Clock that is compatible with MRPT TTimeStamp representation.
Definition: Clock.h:18
std::chrono::duration< rep, period > duration
Definition: Clock.h:24
GLdouble GLdouble t
Definition: glext.h:3695
static time_point fromDouble(const double t) noexcept
Create a timestamp from its double representation.
Definition: Clock.cpp:51
std::chrono::time_point< Clock > time_point
Definition: Clock.h:25
static time_point now() noexcept
Returns the current time, with the highest resolution available.
Definition: Clock.cpp:46
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
static constexpr bool is_steady
Definition: Clock.h:27
std::ratio< 1, 10000000 > period
Definition: Clock.h:23
__int64 int64_t
Definition: glext.h:3456



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 6e6d28d09 Wed Nov 13 18:58:42 2019 +0100 at miƩ nov 13 19:00:09 CET 2019