Skip to main content

derive_sample_interval_ns

Function derive_sample_interval_ns 

Source
pub(crate) fn derive_sample_interval_ns(
    actual_rate: f64,
) -> Result<u64, LJMError>
Expand description

Converts the actual LabJack scan rate into a sample interval in nanoseconds.

The interval is 1e9 / actual_rate, rounded to the nearest nanosecond.

§Arguments

  • actual_rate - Scan rate in Hz returned by stream_start.

§Errors

Returns an error if the rate is not finite or not positive, or if the rounded interval is zero.

§Examples

5000.0 Hz  ->  200_000 ns