limen_platform/linux.rs
1//! Linux / desktop platform adapters.
2//!
3//! > **Status: stub.** The planned `StdClock` implementation (a `PlatformClock`
4//! > backed by `std::time::Instant`) is sketched in commented-out code below.
5//! > It will be activated once the `P1` `PlatformBackend` finalisation work lands.
6// use limen_core::platform::PlatformClock;
7// use limen_core::types::Ticks;
8// use std::time::Instant;
9
10// /// A monotonic clock wrapper for Linux/desktop using `Instant`.
11// #[derive(Debug, Clone)]
12// pub struct StdClock {
13// zero: Instant,
14// }
15
16// impl StdClock {
17// /// Create a new clock epoch.
18// pub fn new() -> Self {
19// Self {
20// zero: Instant::now(),
21// }
22// }
23// }
24
25// impl PlatformClock for StdClock {
26// fn now_ticks(&self) -> Ticks {
27// let dur = self.zero.elapsed();
28// Ticks(dur.as_nanos() as u64)
29// }
30// fn ticks_to_nanos(&self, ticks: Ticks) -> u64 {
31// ticks.0
32// }
33// fn nanos_to_ticks(&self, ns: u64) -> Ticks {
34// Ticks(ns)
35// }
36// }