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 #include <string>
13 
14 namespace mrpt
15 {
16 /** Clock that is compatible with MRPT TTimeStamp representation
17  * \ingroup mrpt_core_grp
18  */
19 class Clock
20 {
21  public:
22  using rep = int64_t;
23  // 100-nanoseconds
24  using period = std::ratio<1, 10000000>;
25  using duration = std::chrono::duration<rep, period>;
26  using time_point = std::chrono::time_point<Clock>;
27 
28  static constexpr bool is_steady = std::chrono::system_clock::is_steady;
29 
30  /** Returns the current time, with the highest resolution available.
31  * Typically this is better than 1 microsecond. */
32  static time_point now() noexcept;
33  /** Create a timestamp from its double representation. \sa toDouble */
34  static time_point fromDouble(const double t) noexcept;
35  /** Converts a timestamp to a UNIX time_t-like number, with fractional part
36  * \sa fromDouble */
37  static double toDouble(const time_point t) noexcept;
38 };
39 } // namespace mrpt
int64_t rep
Definition: Clock.h:22
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:19
std::chrono::duration< rep, period > duration
Definition: Clock.h:25
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:26
static time_point now() noexcept
Returns the current time, with the highest resolution available.
Definition: Clock.cpp:46
__int64 int64_t
Definition: rptypes.h:52
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
static constexpr bool is_steady
Definition: Clock.h:28
std::ratio< 1, 10000000 > period
Definition: Clock.h:24



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019