VMClockShmBody

Struct VMClockShmBody 

Source
#[repr(C)]
pub struct VMClockShmBody {
Show 16 fields pub disruption_marker: u64, pub flags: u64, pub _padding: [u8; 2], pub clock_status: VMClockClockStatus, pub leap_second_smearing_hint: u8, pub tai_offset_sec: i16, pub leap_indicator: u8, pub counter_period_shift: u8, pub counter_value: u64, pub counter_period_frac_sec: u64, pub counter_period_esterror_rate_frac_sec: u64, pub counter_period_maxerror_rate_frac_sec: u64, pub time_sec: u64, pub time_frac_sec: u64, pub time_esterror_nanosec: u64, pub time_maxerror_nanosec: u64,
}
Expand description

Structure that holds the VMClock data captured at a specific point in time.

The structure is shared across the Shared Memory segment and has a C representation to enforce this specific layout.

Fields§

§disruption_marker: u64

Disruption Marker.

This value is incremented (by an unspecified delta) each time the clock is disrupted. This value is specific to a particular VM/EC2 instance.

§flags: u64

Flags.

Bit flags representing the following:

Bit (1 << 0): VMCLOCK_FLAG_TAI_OFFSET_VALID: Indicates that the tai_offset_sec field is valid.

The below bits are optionally used to notify guests of pending maintenance events. A guest which provides latency-sensitive services may wish to remove itself from service if an event is coming up. Two flags indicate the approximate imminence of the event.

Bit (1 << 1): VMCLOCK_FLAG_DISRUPTION_SOON: About a day. Bit (1 << 2): VMCLOCK_FLAG_DISRUPTION_IMMINENT: About an hour. Bit (1 << 3): VMCLOCK_FLAG_PERIOD_ESTERROR_VALID Bit (1 << 4): VMCLOCK_FLAG_PERIOD_MAXERROR_VALID Bit (1 << 5): VMCLOCK_FLAG_TIME_ESTERROR_VALID Bit (1 << 6): VMCLOCK_FLAG_TIME_MAXERROR_VALID

The below bit is the MONOTONIC flag. If the MONOTONIC flag is set then (other than leap seconds) it is guaranteed that the time calculated according this structure at any given moment shall never appear to be later than the time calculated via the structure at any later moment.

In particular, a timestamp based on a counter reading taken immediately after setting the low bit of seq_count (and the associated memory barrier), using the previously-valid time and period fields, shall never be later than a timestamp based on a counter reading taken immediately before clearing the low bit again after the update, using the about-to-be-valid fields.

Bit (1 << 7): VMCLOCK_FLAG_TIME_MONOTONIC

§_padding: [u8; 2]

Padding.

§clock_status: VMClockClockStatus

Clock Status.

The clock status indicates whether the clock is synchronized, free-running, etc.

§leap_second_smearing_hint: u8

The time exposed through this device is never smeared. This field corresponds to the ‘subtype’ field in virtio-rtc, which indicates the smearing method. However in this case it provides a hint to the guest operating system, such that if the guest OS wants to provide its users with an alternative clock which does not follow UTC, it may do so in a fashion consistent with the other systems in the nearby environment.

Possible values are:

VMCLOCK_SMEARING_STRICT: 0 VMCLOCK_SMEARING_NOON_LINEAR: 1 VMCLOCK_SMEARING_UTC_SLS: 2

§tai_offset_sec: i16

Offset between TAI and UTC, in seconds.

§leap_indicator: u8

Leap indicator.

This field is based on the the VIRTIO_RTC_LEAP_xxx values as defined in the current draft of virtio-rtc, but since smearing cannot be used with the shared memory device, some values are not used.

The _POST_POS and _POST_NEG values allow the guest to perform its own smearing during the day or so after a leap second when such smearing may need to continue being applied for a leap second which is now theoretically “historical”.

Possible values are: VMCLOCK_LEAP_NONE 0x00 // No known nearby leap second VMCLOCK_LEAP_PRE_POS 0x01 // Positive leap second at EOM VMCLOCK_LEAP_PRE_NEG 0x02 // Negative leap second at EOM VMCLOCK_LEAP_POS 0x03 // Set during 23:59:60 second VMCLOCK_LEAP_POST_POS 0x04 VMCLOCK_LEAP_POST_NEG 0x05

§counter_period_shift: u8

Counter period shift.

Bit shift for the counter_period_frac_sec and its error rate.

§counter_value: u64

Counter value.

§counter_period_frac_sec: u64

Counter period.

This is the estimated period of the counter, in binary fractional seconds. The unit of this field is: 1 / (2 ^ (64 + counter_period_shift)) of a second.

§counter_period_esterror_rate_frac_sec: u64

Counter period estimated error rate.

This is the estimated error rate of the counter period, in binary fractional seconds per second. The unit of this field is: 1 / (2 ^ (64 + counter_period_shift)) of a second per second.

§counter_period_maxerror_rate_frac_sec: u64

Counter period maximum error rate.

This is the maximum error rate of the counter period, in binary fractional seconds per second. The unit of this field is: 1 / (2 ^ (64 + counter_period_shift)) of a second per second.

§time_sec: u64

Time according to the time_type field. Time: Seconds since time_type epoch.

§time_frac_sec: u64

Time: Fractional seconds, in units of 1 / (2 ^ 64) of a second.

§time_esterror_nanosec: u64

Time: Estimated error.

§time_maxerror_nanosec: u64

Time: Maximum error.

Trait Implementations§

Source§

impl Clone for VMClockShmBody

Source§

fn clone(&self) -> VMClockShmBody

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VMClockShmBody

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VMClockShmBody

Source§

fn default() -> Self

Get a default VMClockShmBody struct Equivalent to zero’ing this bit of memory

Source§

impl PartialEq for VMClockShmBody

Source§

fn eq(&self, other: &VMClockShmBody) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for VMClockShmBody

Source§

impl StructuralPartialEq for VMClockShmBody

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more