From c65a4f162405d1b8c780925b723feeb481c87919 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Mon, 14 Aug 2023 15:53:24 +0400 Subject: Add frame clock Tracks the presentation time and allows querying the next presentation time. --- src/utils.rs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/utils.rs (limited to 'src/utils.rs') diff --git a/src/utils.rs b/src/utils.rs new file mode 100644 index 00000000..9a7d8092 --- /dev/null +++ b/src/utils.rs @@ -0,0 +1,7 @@ +use std::time::Duration; + +use smithay::reexports::nix::time::{clock_gettime, ClockId}; + +pub fn get_monotonic_time() -> Duration { + Duration::from(clock_gettime(ClockId::CLOCK_MONOTONIC).unwrap()) +} -- cgit