pub struct T2TimestampPayload {
pub bw: Bandwidth,
pub seconds_since_2000: u64,
pub subseconds: u32,
pub utco: u16,
}Expand description
DVB-T2 timestamp payload (type 0x20) per ETSI TS 102 773 §5.2.7.
Layout (88 bits = 11 bytes):
- byte 0
[7:4]: rfu (4 bits) — must be 0 - byte 0
[3:0]: bw (4 bits) — Table 3 - bytes 1-5: seconds_since_2000 (40 bits)
- subseconds (27 bits): bytes 6-8 + byte 9
[7:5] - utco (13 bits): byte 9
[4:0]+ byte 10 — UTC offset in seconds
Civil UTC conversion (applying the utco leap-second offset) is intentionally not
provided yet; utco is exposed as a field. emission_offset is in the timestamp’s
own time base relative to 2000-01-01T00:00:00.
Fields§
§bw: BandwidthBandwidth (determines Tsub units).
seconds_since_2000: u64Seconds since 2000-01-01T00:00:00Z. 0 = relative timestamp. If all bits are 1 along with subseconds + utco, this is a Null timestamp.
subseconds: u32Subsecond count (27 bits).
utco: u16UTC offset in seconds (e.g. 34 for leap seconds as of 2016).
Implementations§
Source§impl T2TimestampPayload
impl T2TimestampPayload
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true if this is a Null timestamp (all bits of
seconds_since_2000, subseconds, and utco are 1).
Sourcepub fn is_relative(&self) -> bool
pub fn is_relative(&self) -> bool
Returns true if this is a relative timestamp
(seconds_since_2000 is 0 and is not null).
Sourcepub fn emission_offset(&self) -> Option<Duration>
pub fn emission_offset(&self) -> Option<Duration>
Time elapsed since 2000-01-01T00:00:00 in the timestamp’s own time base.
Returns None for a Null timestamp.
Civil UTC conversion (applying the utco leap-second offset) is
intentionally not provided yet; utco is exposed as a field.
Sourcepub fn set_emission_offset(&mut self, offset: Duration) -> Result<(), Error>
pub fn set_emission_offset(&mut self, offset: Duration) -> Result<(), Error>
Set seconds_since_2000 and subseconds from a core::time::Duration
using the current bw. Leaves bw and utco unchanged.
§Errors
Returns ReservedBitsViolation
if the duration exceeds the 40-bit seconds or 27-bit subseconds range.
Trait Implementations§
Source§impl Clone for T2TimestampPayload
impl Clone for T2TimestampPayload
Source§fn clone(&self) -> T2TimestampPayload
fn clone(&self) -> T2TimestampPayload
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for T2TimestampPayload
impl Debug for T2TimestampPayload
impl Eq for T2TimestampPayload
Source§impl<'a> From<T2TimestampPayload> for AnyPayload<'a>
impl<'a> From<T2TimestampPayload> for AnyPayload<'a>
Source§fn from(p: T2TimestampPayload) -> Self
fn from(p: T2TimestampPayload) -> Self
Source§impl<'a> Parse<'a> for T2TimestampPayload
impl<'a> Parse<'a> for T2TimestampPayload
Source§impl PartialEq for T2TimestampPayload
impl PartialEq for T2TimestampPayload
Source§fn eq(&self, other: &T2TimestampPayload) -> bool
fn eq(&self, other: &T2TimestampPayload) -> bool
self and other values to be equal, and is used by ==.Source§impl<'a> PayloadDef<'a> for T2TimestampPayload
impl<'a> PayloadDef<'a> for T2TimestampPayload
Source§impl Serialize for T2TimestampPayload
impl Serialize for T2TimestampPayload
Source§impl Serialize for T2TimestampPayload
impl Serialize for T2TimestampPayload
Source§type Error = Error
type Error = Error
Parse impl, but need not be).Source§fn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
serialize_into will write.