#[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: u64Disruption 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: u64Flags.
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: VMClockClockStatusClock Status.
The clock status indicates whether the clock is synchronized, free-running, etc.
leap_second_smearing_hint: u8The 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: i16Offset between TAI and UTC, in seconds.
leap_indicator: u8Leap 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: u8Counter period shift.
Bit shift for the counter_period_frac_sec and its error rate.
counter_value: u64Counter value.
counter_period_frac_sec: u64Counter 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: u64Counter 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: u64Counter 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: u64Time according to the time_type field. Time: Seconds since time_type epoch.
time_frac_sec: u64Time: Fractional seconds, in units of 1 / (2 ^ 64) of a second.
time_esterror_nanosec: u64Time: Estimated error.
time_maxerror_nanosec: u64Time: Maximum error.
Trait Implementations§
Source§impl Clone for VMClockShmBody
impl Clone for VMClockShmBody
Source§fn clone(&self) -> VMClockShmBody
fn clone(&self) -> VMClockShmBody
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more