Skip to main content

MediaClock

Struct MediaClock 

Source
pub struct MediaClock { /* private fields */ }
Expand description

gPTP time, read through the monotonic clock.

Implementations§

Source§

impl MediaClock

Source

pub fn gptpd(interface: &str) -> Self

gPTP time as gptpd gives it for interface, on Linux; elsewhere, and until gptpd gives it, the monotonic clock.

Source

pub fn monotonic() -> Self

The monotonic clock alone: streams flow, but their presentation times mean nothing to other entities.

Source

pub fn locked(&self) -> bool

Whether gPTP time is a grandmaster’s, followed or this system’s, rather than the monotonic clock’s or an old line carried on.

Source

pub fn generation(&self) -> u32

Counts gPTP time’s discontinuities: a stream’s timeline built on it before a change is no longer good after.

Source

pub fn last_step(&self) -> i64

How far gPTP time moved at the last discontinuity, in nanoseconds: against the monotonic clock at the first, against the last line after.

Source

pub fn now(&self) -> i64

gPTP time now, in nanoseconds.

Source

pub fn offset(&self) -> i64

gPTP time less monotonic time, in nanoseconds.

Source

pub fn monotonic_at(&self, gptp: i64) -> Duration

The monotonic time at which gPTP time reaches gptp nanoseconds.

Source

pub fn card_at(&self, gptp: i64) -> Option<u64>

The card’s clock, in nanoseconds on CLOCK_TAI’s scale, when gPTP time reaches gptp: the launch time of a frame due then. None where gptpd does not keep the card’s clock near CLOCK_TAI, or a new line waits to be confirmed.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.