Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
timeutil_sync_state Struct Reference

State required to convert instants between time scales. More...

#include <timeutil.h>

Data Fields

const struct timeutil_sync_configcfg
 Pointer to reference and local rate information.
 
struct timeutil_sync_instant base
 The base instant in both time scales.
 
struct timeutil_sync_instant latest
 The most recent instant in both time scales.
 
float skew
 The scale factor used to correct for clock skew.
 

Detailed Description

State required to convert instants between time scales.

This state in conjunction with functions that manipulate it capture the offset information necessary to convert between two timescales along with information that corrects for skew due to inaccuracies in clock rates.

State objects should be zero-initialized before use.

Field Documentation

◆ base

struct timeutil_sync_instant timeutil_sync_state::base

The base instant in both time scales.

◆ cfg

const struct timeutil_sync_config* timeutil_sync_state::cfg

Pointer to reference and local rate information.

◆ latest

struct timeutil_sync_instant timeutil_sync_state::latest

The most recent instant in both time scales.

This is captured here to provide data for skew calculation.

◆ skew

float timeutil_sync_state::skew

The scale factor used to correct for clock skew.

The nominal rate for the local counter is assumed to be inaccurate but stable, i.e. it will generally be some parts-per-million faster or slower than specified.

A duration in observed local clock ticks must be multiplied by this value to produce a duration in ticks of a clock operating at the nominal local rate.

A zero value indicates that the skew has not been initialized. If the value is zero when base is initialized the skew will be set to 1. Otherwise the skew is assigned through timeutil_sync_state_set_skew().


The documentation for this struct was generated from the following file: