[libgpiod][PATCH] bindings: cxx: fix building gpiod::timestamp with clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>

Clang's system_clock implementation uses microseconds resolution by
default and we fail to construct a time_point out of chrono::nanoseconds
as the library prohibits us from accidentally losing information when
casting the latter to the former. Use nanoseconds explicitly as the
resolution of the realtime timestamp.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
---
 bindings/cxx/gpiodcxx/timestamp.hpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bindings/cxx/gpiodcxx/timestamp.hpp b/bindings/cxx/gpiodcxx/timestamp.hpp
index 2eaadd2..5efeb4c 100644
--- a/bindings/cxx/gpiodcxx/timestamp.hpp
+++ b/bindings/cxx/gpiodcxx/timestamp.hpp
@@ -38,7 +38,8 @@ public:
 	/**
 	 * @brief Real-time time_point.
 	 */
-	using time_point_realtime = ::std::chrono::time_point<::std::chrono::system_clock>;
+	using time_point_realtime = ::std::chrono::time_point<::std::chrono::system_clock,
+							      ::std::chrono::nanoseconds>;
 
 	/**
 	 * @brief Constructor with implicit  conversion from `uint64_t`.
-- 
2.37.2




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux