Kea  1.9.9-git
isc::util::detail Namespace Reference

Functions

int64_t gettimeWrapper ()
 Return the current time in seconds. More...
 

Variables

int64_t(* gettimeFunction )() = NULL
 

Function Documentation

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 109 of file time_utilities.cc.

References gettimeFunction.

Referenced by isc::util::timeToText32().

Variable Documentation

int64_t(* isc::util::detail::gettimeFunction) () = NULL

Definition at line 106 of file time_utilities.cc.

Referenced by gettimeWrapper().