1
0
Fork 0
forked from wry/wry

metal: delay rendering until shortly before page flip

This commit is contained in:
Julian Orth 2024-05-20 15:29:16 +02:00
parent 33d5c61c37
commit c2d31cb639
9 changed files with 113 additions and 22 deletions

View file

@ -62,7 +62,12 @@ impl Time {
}
}
#[allow(dead_code)]
pub fn nsec(self) -> u64 {
let sec = self.0.tv_sec as u64 * 1_000_000_000;
let nsec = self.0.tv_nsec as u64;
sec + nsec
}
pub fn usec(self) -> u64 {
let sec = self.0.tv_sec as u64 * 1_000_000;
let nsec = self.0.tv_nsec as u64 / 1_000;
@ -119,6 +124,10 @@ impl Add<Duration> for Time {
}
}
pub fn now_nsec() -> u64 {
Time::now_unchecked().nsec()
}
pub fn now_usec() -> u64 {
Time::now_unchecked().usec()
}