summaryrefslogtreecommitdiffstats
path: root/sys/sys/timeffc.h
diff options
context:
space:
mode:
authorlstewart <lstewart@FreeBSD.org>2011-11-20 01:20:50 +0000
committerlstewart <lstewart@FreeBSD.org>2011-11-20 01:20:50 +0000
commit603d3fe159020ac54459dc1a09c0c38195319b0e (patch)
tree5f555a85e24e68d26f7cb24a76877c0522c349bf /sys/sys/timeffc.h
parente81c24c8baa4708ab717531d4e959b48ba6d32a1 (diff)
downloadFreeBSD-src-603d3fe159020ac54459dc1a09c0c38195319b0e.zip
FreeBSD-src-603d3fe159020ac54459dc1a09c0c38195319b0e.tar.gz
Provide high-level functions to access the feed-forward absolute and difference
clocks. Each routine can output an upper bound on the absolute time or time interval requested. Different flavours of absolute time can be requested, for example with or without leap seconds, monotonic or not, etc. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Submitted by: Julien Ridoux (jridoux at unimelb edu au)
Diffstat (limited to 'sys/sys/timeffc.h')
-rw-r--r--sys/sys/timeffc.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/sys/timeffc.h b/sys/sys/timeffc.h
index f7b0d4e..7e22632 100644
--- a/sys/sys/timeffc.h
+++ b/sys/sys/timeffc.h
@@ -105,6 +105,29 @@ void ffclock_last_tick(ffcounter *ffcount, struct bintime *bt, uint32_t flags);
void ffclock_convert_abs(ffcounter ffcount, struct bintime *bt, uint32_t flags);
void ffclock_convert_diff(ffcounter ffdelta, struct bintime *bt);
+/*
+ * Feed-forward clock routines.
+ *
+ * These functions rely on the timecounters and ffclock_estimates stored in
+ * fftimehands. Note that the error_bound parameter is not the error of the
+ * clock but an upper bound on the error of the absolute time or time interval
+ * returned.
+ *
+ * ffclock_abstime(): retrieves current time as counter value and convert this
+ * timestamp in seconds. The value (in seconds) of the converted timestamp
+ * depends on the flags passed: for a given counter value, different
+ * conversions are possible. Different clock models can be selected by
+ * combining flags (for example (FFCLOCK_LERP|FFCLOCK_UPTIME) produces
+ * linearly interpolated uptime).
+ * ffclock_difftime(): computes a time interval in seconds based on an interval
+ * measured in ffcounter units. This should be the preferred way to measure
+ * small time intervals very accurately.
+ */
+void ffclock_abstime(ffcounter *ffcount, struct bintime *bt,
+ struct bintime *error_bound, uint32_t flags);
+void ffclock_difftime(ffcounter ffdelta, struct bintime *bt,
+ struct bintime *error_bound);
+
#endif /* _KERNEL */
#endif /* __BSD_VISIBLE */
#endif /* _SYS_TIMEFF_H_ */
OpenPOWER on IntegriCloud