libgpiod  2.0.1
Public Types | Public Member Functions
gpiod::timestamp Class Referencefinal

Stores the edge and info event timestamps as returned by the kernel and allows to convert them to std::chrono::time_point. More...

#include <timestamp.hpp>

Public Types

using time_point_monotonic = ::std::chrono::time_point<::std::chrono::steady_clock >
 Monotonic time_point.
 
using time_point_realtime = ::std::chrono::time_point<::std::chrono::system_clock, ::std::chrono::nanoseconds >
 Real-time time_point.
 

Public Member Functions

 timestamp (::std::uint64_t ns)
 Constructor with implicit conversion from uint64_t. More...
 
 timestamp (const timestamp &other) noexcept=default
 Copy constructor. More...
 
 timestamp (timestamp &&other) noexcept=default
 Move constructor. More...
 
timestampoperator= (const timestamp &other) noexcept=default
 Assignment operator. More...
 
timestampoperator= (timestamp &&other) noexcept=default
 Move assignment operator. More...
 
 operator::std::uint64_t () noexcept
 Conversion operator to std::uint64_t.
 
::std::uint64_t ns () const noexcept
 Get the timestamp in nanoseconds. More...
 
time_point_monotonic to_time_point_monotonic () const
 Convert the timestamp to a monotonic time_point. More...
 
time_point_realtime to_time_point_realtime () const
 Convert the timestamp to a real-time time_point. More...
 

Detailed Description

Stores the edge and info event timestamps as returned by the kernel and allows to convert them to std::chrono::time_point.

Definition at line 29 of file timestamp.hpp.

Constructor & Destructor Documentation

◆ timestamp() [1/3]

gpiod::timestamp::timestamp ( ::std::uint64_t  ns)
inline

Constructor with implicit conversion from uint64_t.

Parameters
nsTimestamp in nanoseconds.

Definition at line 48 of file timestamp.hpp.

◆ timestamp() [2/3]

gpiod::timestamp::timestamp ( const timestamp other)
defaultnoexcept

Copy constructor.

Parameters
otherObject to copy.

◆ timestamp() [3/3]

gpiod::timestamp::timestamp ( timestamp &&  other)
defaultnoexcept

Move constructor.

Parameters
otherObject to move.

Member Function Documentation

◆ ns()

::std::uint64_t gpiod::timestamp::ns ( ) const
inlinenoexcept

Get the timestamp in nanoseconds.

Returns
Timestamp in nanoseconds.

Definition at line 90 of file timestamp.hpp.

Referenced by operator::std::uint64_t(), to_time_point_monotonic(), and to_time_point_realtime().

◆ operator=() [1/2]

timestamp& gpiod::timestamp::operator= ( const timestamp other)
defaultnoexcept

Assignment operator.

Parameters
otherObject to copy.
Returns
Reference to self.

◆ operator=() [2/2]

timestamp& gpiod::timestamp::operator= ( timestamp &&  other)
defaultnoexcept

Move assignment operator.

Parameters
otherObject to move.
Returns
Reference to self.

◆ to_time_point_monotonic()

time_point_monotonic gpiod::timestamp::to_time_point_monotonic ( ) const
inline

Convert the timestamp to a monotonic time_point.

Returns
time_point associated with the steady clock.

Definition at line 99 of file timestamp.hpp.

References ns().

◆ to_time_point_realtime()

time_point_realtime gpiod::timestamp::to_time_point_realtime ( ) const
inline

Convert the timestamp to a real-time time_point.

Returns
time_point associated with the system clock.

Definition at line 108 of file timestamp.hpp.

References ns().


The documentation for this class was generated from the following file: