libgpiodcxx misc interfaces

class timestamp

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

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 Functions

inline timestamp(::std::uint64_t ns)

Constructor with implicit conversion from uint64_t.

Parameters:

ns – Timestamp in nanoseconds.

timestamp(const timestamp &other) noexcept = default

Copy constructor.

Parameters:

other – Object to copy.

timestamp(timestamp &&other) noexcept = default

Move constructor.

Parameters:

other – Object to move.

timestamp &operator=(const timestamp &other) noexcept = default

Assignment operator.

Parameters:

other – Object to copy.

Returns:

Reference to self.

timestamp &operator=(timestamp &&other) noexcept = default

Move assignment operator.

Parameters:

other – Object to move.

Returns:

Reference to self.

inline operator ::std::uint64_t() noexcept

Conversion operator to std::uint64_t.

inline ::std::uint64_t ns() const noexcept

Get the timestamp in nanoseconds.

Returns:

Timestamp in nanoseconds.

inline time_point_monotonic to_time_point_monotonic() const

Convert the timestamp to a monotonic time_point.

Returns:

time_point associated with the steady clock.

inline time_point_realtime to_time_point_realtime() const

Convert the timestamp to a real-time time_point.

Returns:

time_point associated with the system clock.

bool gpiod::is_gpiochip_device(const ::std::filesystem::path &path)

Check if the file pointed to by path is a GPIO chip character device.

Parameters:

path – Path to check.

Returns:

True if the file exists and is a GPIO chip character device or a symbolic link to it.

const ::std::string &gpiod::api_version()

Get the human readable version string for libgpiod API.

Returns:

String containing the library version.