aboutsummaryrefslogtreecommitdiff
path: root/src/utils.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-08-14 15:53:24 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-08-14 15:53:24 +0400
commitc65a4f162405d1b8c780925b723feeb481c87919 (patch)
treeba18ba0bcafc2bbf2c0014179679479325441fdb /src/utils.rs
parent529a24cc14859890029ad20ba07a589f4b3bc559 (diff)
downloadniri-c65a4f162405d1b8c780925b723feeb481c87919.tar.gz
niri-c65a4f162405d1b8c780925b723feeb481c87919.tar.bz2
niri-c65a4f162405d1b8c780925b723feeb481c87919.zip
Add frame clock
Tracks the presentation time and allows querying the next presentation time.
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs7
1 files changed, 7 insertions, 0 deletions
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())
+}