# [−][src]Struct hifitime::ClockNoise

ClockNoise adds true clock drift to a given Duration measurement. For example, if a vehicle is
measuring the time of flight of a signal with high precision oscillator, the engineering
specifications will include the oscillator stability. This specification bounds the preciseness
of time span calculations. On very short time spans, i.e. less than a few minutes, clock drift
is usually negligible. However, in several high fidelity systems the clock drift may lead to
a significant error (e.g. several kilometers in two-way radar ranging). This module allows high
fidelity simulation systems to test the resilience of algorithms with oscillator stability.
The constructors here are specified in parts per million: for a parts per billion specification
simply multiply the value by `1e-3`

.
*NOTE:* Clock stability is not linear. If a clock is rated at stable within 15 ppm per
fifteen minute interval this *does not* correspond to 1 ppm per minute.

# Example

use hifitime::ClockNoise; // The IRIS clock is 1 part per billion over one second let nasa_iris = ClockNoise::with_ppm_over_1sec(1e-3); let ddoor = 8.0 * 60.0; let noisy = nasa_iris.noise_up(ddoor); assert!( (noisy - ddoor).abs() < 1e-3, "Expected a zero deviation for IRIS" );

## Methods

`impl ClockNoise`

[src]

`pub fn with_ppm(ppm: f64) -> ClockNoise`

[src]

Creates a new ClockNoise generator from the stability characteristics in absolute parts per million The ppm value is assumed to be the 7-sigma deviation.

`pub fn with_ppm_over_1sec(ppm: f64) -> ClockNoise`

[src]

Creates a new ClockNoise generator from the stability characteristics in parts per million
over **one** second.

`pub fn with_ppm_over_1min(ppm: f64) -> ClockNoise`

[src]

Creates a new ClockNoise generator from the stability characteristics in parts per million
over **one minute** (i.e. 60 seconds).

`pub fn with_ppm_over_15min(ppm: f64) -> ClockNoise`

[src]

Creates a new ClockNoise generator from the stability characteristics in parts per million
over **fifteen minutes** (i.e. 900 seconds).

`pub fn noise_up(&self, duration_in_secs: f64) -> f64`

[src]

From an input set of seconds, returns a random walk number of seconds corresponding to the value plus/minus a drift

`pub fn sample(&self, value: f64) -> f64`

[src]

Sample the clock for a specific value. Can be used to determined a sampled frequency from an input frequency in Hertz

## Auto Trait Implementations

`impl Send for ClockNoise`

`impl Sync for ClockNoise`

`impl Unpin for ClockNoise`

`impl UnwindSafe for ClockNoise`

`impl RefUnwindSafe for ClockNoise`

## Blanket Implementations

`impl<T> From<T> for T`

[src]

`impl<T, U> Into<U> for T where`

U: From<T>,

[src]

U: From<T>,

`impl<T, U> TryFrom<U> for T where`

U: Into<T>,

[src]

U: Into<T>,

`type Error = !`

The type returned in the event of a conversion error.

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

[src]

`impl<T, U> TryInto<U> for T where`

U: TryFrom<T>,

[src]

U: TryFrom<T>,

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

The type returned in the event of a conversion error.

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

[src]

`impl<T> Borrow<T> for T where`

T: ?Sized,

[src]

T: ?Sized,

`impl<T> BorrowMut<T> for T where`

T: ?Sized,

[src]

T: ?Sized,

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

[src]

`impl<T> Any for T where`

T: 'static + ?Sized,

[src]

T: 'static + ?Sized,

`impl<V, T> VZip<V> for T where`

V: MultiLane<T>,

V: MultiLane<T>,