Refactor isc_time_now() to return time, and not result

The isc_time_now() and isc_time_now_hires() were used inconsistently
through the code - either with status check, or without status check,
or via TIME_NOW() macro with RUNTIME_CHECK() on failure.

Refactor the isc_time_now() and isc_time_now_hires() to always fail when
getting current time has failed, and return the isc_time_t value as
return value instead of passing the pointer to result in the argument.
This commit is contained in:
Ondřej Surý
2023-03-31 00:12:33 +02:00
parent da039ec2b3
commit a5f5f68502
39 changed files with 228 additions and 226 deletions

View File

@@ -166,8 +166,8 @@ isc_time_monotonic(void);
* Returns the system's monotonic time in linear nanoseconds.
*/
isc_result_t
isc_time_now(isc_time_t *t);
isc_time_t
isc_time_now(void);
/*%<
* Set 't' to the current absolute time.
*
@@ -185,8 +185,8 @@ isc_time_now(isc_time_t *t);
* in the current definition of isc_time_t.
*/
isc_result_t
isc_time_now_hires(isc_time_t *t);
isc_time_t
isc_time_now_hires(void);
/*%<
* Set 't' to the current absolute time. Uses higher resolution clocks
* recommended when microsecond accuracy is required.

View File

@@ -357,13 +357,6 @@ mock_assert(const int result, const char *const expression,
FATAL_SYSERROR(ret, "%s()", #func); \
}
/*%
* 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
*/