feat(runtime): add host wall clock and administrative UTC timestamps
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
Intrepid/Prometeu/Runtime/pipeline/pr-master This commit looks good
This commit is contained in:
@@ -38,6 +38,7 @@ pub mod tilemap;
|
||||
pub mod touch_bridge;
|
||||
pub mod value_snapshot;
|
||||
pub mod vm_fault;
|
||||
pub mod wall_clock;
|
||||
|
||||
pub use asset_bridge::AssetBridge;
|
||||
pub use audio_bridge::{AudioBridge, AudioOpStatus, LoopMode};
|
||||
@@ -66,3 +67,4 @@ pub use render_worker::{
|
||||
};
|
||||
pub use touch_bridge::TouchBridge;
|
||||
pub use value_snapshot::ValueSnapshot;
|
||||
pub use wall_clock::WallClock;
|
||||
|
||||
@@ -6,6 +6,7 @@ use crate::render_submission::{Game2DFramePacket, RenderSubmission};
|
||||
use crate::sprite::Sprite;
|
||||
use crate::telemetry::TelemetryFrame;
|
||||
use crate::touch_bridge::TouchBridge;
|
||||
use crate::wall_clock::WallClock;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum RenderSubmitError {
|
||||
@@ -60,6 +61,8 @@ pub struct NoopTelemetryPlatform;
|
||||
impl TelemetryPlatform for NoopTelemetryPlatform {}
|
||||
|
||||
pub trait RuntimePlatform {
|
||||
fn wall_clock(&self) -> &dyn WallClock;
|
||||
|
||||
fn display_size(&self) -> (usize, usize) {
|
||||
(480, 270)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/// Host civil time for administrative timestamps, independent of gameplay and deadlines.
|
||||
///
|
||||
/// Reads must be local and bounded, without waiting for IO or clock synchronization.
|
||||
/// The host always supplies a value, even when its civil clock is incorrect.
|
||||
pub trait WallClock {
|
||||
/// Whole UTC seconds since the Unix epoch, with fractions discarded.
|
||||
///
|
||||
/// Values outside the unsigned range saturate to zero or `u64::MAX`.
|
||||
/// Successive reads may go backwards when the host adjusts its clock.
|
||||
fn utc_unix_seconds(&self) -> u64;
|
||||
}
|
||||
Reference in New Issue
Block a user