Struct symphonia_core::units::TimeBase
source · pub struct TimeBase {
pub numer: u32,
pub denom: u32,
}
Expand description
A TimeBase
is the conversion factor between time, expressed in seconds, and a TimeStamp
or
Duration
.
In other words, a TimeBase
is the length in seconds of one tick of a TimeStamp
or
Duration
.
Fields§
§numer: u32
The numerator.
denom: u32
The denominator.
Implementations§
source§impl TimeBase
impl TimeBase
sourcepub fn new(numer: u32, denom: u32) -> Self
pub fn new(numer: u32, denom: u32) -> Self
Creates a new TimeBase
. Panics if either the numerator or denominator is 0.
sourcepub fn calc_time(&self, ts: TimeStamp) -> Time
pub fn calc_time(&self, ts: TimeStamp) -> Time
Accurately calculates a Time
using the TimeBase
and the provided TimeStamp
. On
overflow, the seconds field of Time
wraps.
sourcepub fn calc_timestamp(&self, time: Time) -> TimeStamp
pub fn calc_timestamp(&self, time: Time) -> TimeStamp
Accurately calculates a TimeStamp
from the given Time
using the TimeBase
as the
conversion factor. On overflow, the TimeStamp
wraps.
Trait Implementations§
source§impl Ord for TimeBase
impl Ord for TimeBase
source§impl PartialEq for TimeBase
impl PartialEq for TimeBase
source§impl PartialOrd for TimeBase
impl PartialOrd for TimeBase
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for TimeBase
impl Eq for TimeBase
impl StructuralPartialEq for TimeBase
Auto Trait Implementations§
impl RefUnwindSafe for TimeBase
impl Send for TimeBase
impl Sync for TimeBase
impl Unpin for TimeBase
impl UnwindSafe for TimeBase
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