Kea 2.7.5
|
Functions | |
int64_t | getTimeWrapper () |
Return the current time in seconds. | |
Variables | |
int64_t(* | getTimeFunction )()=0 |
int64_t isc::util::detail::getTimeWrapper | ( | ) |
Return the current time in seconds.
This function returns the "current" time in seconds from epoch (00:00:00 January 1, 1970) as a 64-bit signed integer. The return value can represent a point of time before epoch as a negative number.
This function is provided to help test time conscious implementations such as DNSSEC and TSIG signatures. It is difficult to test them with an unusual or a specifically chosen "current" via system-provided library functions to get time. This function acts as a straightforward wrapper of such a library function, but provides test code with a hook to return an arbitrary time value: if isc::util::detail::getTimeFunction
is set to a pointer of function that returns 64-bit signed integer, getTimeWrapper()
calls that function instead of the system library.
This hook variable is specifically intended for testing purposes, so, even if it's visible outside of this library, it's not even declared in a header file.
If the implementation doesn't need to be tested with faked current time, it should simply use the system supplied library function instead of this one.
Definition at line 72 of file time_utils.cc.
References getTimeFunction.
Referenced by isc::util::timeToText32().
int64_t(* isc::util::detail::getTimeFunction) ()=0 | ( | ) |
Definition at line 69 of file time_utils.cc.
Referenced by getTimeWrapper().