21#ifndef ZEPHYR_INCLUDE_SYS_TIMEUTIL_H_
22#define ZEPHYR_INCLUDE_SYS_TIMEUTIL_H_
_TIME_T_ time_t
Definition: _timespec.h:14
time_t timeutil_timegm(const struct tm *tm)
Convert broken-down time to a POSIX epoch offset in seconds.
int64_t timeutil_timegm64(const struct tm *tm)
Convert broken-down time to a POSIX epoch offset in seconds.
int timeutil_sync_state_set_skew(struct timeutil_sync_state *tsp, float skew, const struct timeutil_sync_instant *base)
Update the state with a new skew and possibly base value.
int timeutil_sync_ref_from_local(const struct timeutil_sync_state *tsp, uint64_t local, uint64_t *refp)
Interpolate a reference timescale instant from a local instant.
int timeutil_sync_state_update(struct timeutil_sync_state *tsp, const struct timeutil_sync_instant *inst)
Record a new instant in the time synchronization state.
int32_t timeutil_sync_skew_to_ppb(float skew)
Convert from a skew to an error in parts-per-billion.
float timeutil_sync_estimate_skew(const struct timeutil_sync_state *tsp)
Estimate the skew based on current state.
int timeutil_sync_local_from_ref(const struct timeutil_sync_state *tsp, uint64_t ref, int64_t *localp)
Interpolate a local timescale instant from a reference instant.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT64_TYPE__ uint64_t
Definition: stdint.h:91
__INT64_TYPE__ int64_t
Definition: stdint.h:75
Immutable state for synchronizing two clocks.
Definition: timeutil.h:83
uint32_t ref_Hz
The nominal instance counter rate in Hz.
Definition: timeutil.h:91
uint32_t local_Hz
The nominal local counter rate in Hz.
Definition: timeutil.h:104
Representation of an instant in two time scales.
Definition: timeutil.h:114
uint64_t ref
An instant in the reference time scale.
Definition: timeutil.h:120
uint64_t local
The corresponding instance in the local time scale.
Definition: timeutil.h:126
State required to convert instants between time scales.
Definition: timeutil.h:139
const struct timeutil_sync_config * cfg
Pointer to reference and local rate information.
Definition: timeutil.h:141
float skew
The scale factor used to correct for clock skew.
Definition: timeutil.h:167
struct timeutil_sync_instant latest
The most recent instant in both time scales.
Definition: timeutil.h:150
struct timeutil_sync_instant base
The base instant in both time scales.
Definition: timeutil.h:144