Use monotonic clock for relative time for eloop if available

Relative time shouldn't be calculated based on gettimeofday
because that clock can jump (e.g., when the time is adjusted
by the system administrator.)

On systems where that is available, use CLOCK_BOOTTIME (on
fairly recent Linux systems, this clock takes into account
the time spend suspended) or CLOCK_MONOTONIC (on Linux and
some POSIX systems, this clock is just freely running with
no adjustments.)

Reported-by: Holger Schurig <holgerschurig@gmail.com>
Signed-hostap: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2013-11-20 11:01:09 +01:00 committed by Jouni Malinen
parent 461e3ebe43
commit 594516b4c2
12 changed files with 184 additions and 62 deletions

View file

@ -207,7 +207,7 @@ int eloop_cancel_timeout(eloop_timeout_handler handler,
*/
int eloop_cancel_timeout_one(eloop_timeout_handler handler,
void *eloop_data, void *user_data,
struct os_time *remaining);
struct os_reltime *remaining);
/**
* eloop_is_timeout_registered - Check if a timeout is already registered