mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 20:26:42 +01:00
invoke timebase callback, persists state but doesn't seem to do anything
This commit is contained in:
parent
ae69e87dc9
commit
003329aa1b
10 changed files with 350 additions and 329 deletions
15
src/time/microsecond.rs
Normal file
15
src/time/microsecond.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use crate::*;
|
||||
|
||||
/// Timestamp in microseconds
|
||||
#[derive(Debug, Default)] pub struct Microsecond(AtomicF64);
|
||||
|
||||
impl_time_unit!(Microsecond);
|
||||
|
||||
impl Microsecond {
|
||||
#[inline] pub fn format_msu (&self) -> String {
|
||||
let usecs = self.get() as usize;
|
||||
let (seconds, msecs) = (usecs / 1000000, usecs / 1000 % 1000);
|
||||
let (minutes, seconds) = (seconds / 60, seconds % 60);
|
||||
format!("{minutes}:{seconds:02}:{msecs:03}")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue