#[repr(C)]pub struct SyncedTimestamp(pub u64);Expand description
A synchronized timestamp in microseconds since server start.
Used for scheduling events across distributed nodes with sample-accurate timing within audio buffers.
Tuple Fields§
§0: u64Implementations§
Source§impl SyncedTimestamp
impl SyncedTimestamp
Sourcepub const fn from_micros(micros: u64) -> Self
pub const fn from_micros(micros: u64) -> Self
Create a timestamp from microseconds.
Sourcepub fn to_sample_offset(
&self,
buffer_start_time: SyncedTimestamp,
sample_rate: f64,
buffer_size: usize,
) -> Option<u32>
pub fn to_sample_offset( &self, buffer_start_time: SyncedTimestamp, sample_rate: f64, buffer_size: usize, ) -> Option<u32>
Convert to sample offset within a buffer.
Returns Some(offset) if the timestamp falls within the current buffer,
None if it’s in a future buffer. Events in the past return offset 0.
§Arguments
buffer_start_time- Timestamp at the start of the current buffersample_rate- Audio sample rate in Hzbuffer_size- Number of samples in the buffer
Sourcepub fn delta(&self, other: SyncedTimestamp) -> i64
pub fn delta(&self, other: SyncedTimestamp) -> i64
Calculate the difference between two timestamps in microseconds.
Trait Implementations§
Source§impl Clone for SyncedTimestamp
impl Clone for SyncedTimestamp
Source§fn clone(&self) -> SyncedTimestamp
fn clone(&self) -> SyncedTimestamp
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SyncedTimestamp
impl Debug for SyncedTimestamp
Source§impl Default for SyncedTimestamp
impl Default for SyncedTimestamp
Source§fn default() -> SyncedTimestamp
fn default() -> SyncedTimestamp
Returns the “default value” for a type. Read more
Source§impl Ord for SyncedTimestamp
impl Ord for SyncedTimestamp
Source§fn cmp(&self, other: &SyncedTimestamp) -> Ordering
fn cmp(&self, other: &SyncedTimestamp) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for SyncedTimestamp
impl PartialEq for SyncedTimestamp
Source§impl PartialOrd for SyncedTimestamp
impl PartialOrd for SyncedTimestamp
impl Copy for SyncedTimestamp
impl Eq for SyncedTimestamp
impl StructuralPartialEq for SyncedTimestamp
Auto Trait Implementations§
impl Freeze for SyncedTimestamp
impl RefUnwindSafe for SyncedTimestamp
impl Send for SyncedTimestamp
impl Sync for SyncedTimestamp
impl Unpin for SyncedTimestamp
impl UnwindSafe for SyncedTimestamp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more