bindings: cxx: fix building gpiod::timestamp with clang
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 10 Feb 2023 12:54:18 +0000 (13:54 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 10 Feb 2023 12:54:18 +0000 (13:54 +0100)
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@linaro.org>
bindings/cxx/gpiodcxx/timestamp.hpp

index 2eaadd277a11184b4d80e8e907ff97db7379d050..5efeb4c2baa987581cb25958465ab4eee854e345 100644 (file)
@@ -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`.