mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Add isc_time_now_hires function to get current time with high resolution
The current isc_time_now uses CLOCK_REALTIME_COARSE which only updates on a timer tick. This clock is generally fine for millisecond accuracy, but on servers with 100hz clocks, this clock is nowhere near accurate enough for microsecond accuracy. This commit adds a new isc_time_now_hires function that uses CLOCK_REALTIME, which gives the current time, though it is somewhat expensive to call. When microsecond accuracy is required, it may be required to use extra resources for higher accuracy.
This commit is contained in:
committed by
Evan Hunt
parent
bee4ee931f
commit
ebced74b19
@@ -340,6 +340,8 @@ mock_assert(const int result, const char *const expression,
|
||||
* Time
|
||||
*/
|
||||
#define TIME_NOW(tp) RUNTIME_CHECK(isc_time_now((tp)) == ISC_R_SUCCESS)
|
||||
#define TIME_NOW_HIRES(tp) \
|
||||
RUNTIME_CHECK(isc_time_now_hires((tp)) == ISC_R_SUCCESS)
|
||||
|
||||
/*%
|
||||
* Alignment
|
||||
|
Reference in New Issue
Block a user