Introduce SystemTime to Event in iced_sentinel

This commit is contained in:
Héctor Ramón Jiménez 2024-02-28 16:06:55 +01:00
parent 8591e5a148
commit 3d90665f9d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
5 changed files with 74 additions and 28 deletions

View file

@ -48,7 +48,7 @@ pub fn time(window: window::Id, name: impl AsRef<str>) -> Timer {
#[cfg(feature = "enable")]
mod internal {
use crate::core::time::Instant;
use crate::core::time::{Instant, SystemTime};
use crate::core::window;
use crate::style::theme;
@ -104,6 +104,7 @@ mod internal {
Timer {
stage,
start: Instant::now(),
start_system_time: SystemTime::now(),
}
}
@ -111,12 +112,14 @@ mod internal {
pub struct Timer {
stage: timing::Stage,
start: Instant,
start_system_time: SystemTime,
}
impl Timer {
pub fn finish(self) {
lock().sentinel.report_timing(Timing {
stage: self.stage,
start: self.start_system_time,
duration: self.start.elapsed(),
});
}