From ed0ebee14f584f5cf536e9dc54bfd9ae9424c947 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Mon, 25 Nov 2013 21:56:02 +0100 Subject: [PATCH] OS utils: Provide os_reltime_age() This function calculates and returns the time passed since a given timestamp. Signed-hostap: Johannes Berg --- src/utils/os.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/utils/os.h b/src/utils/os.h index 77dc6e38a..6689d447d 100644 --- a/src/utils/os.h +++ b/src/utils/os.h @@ -86,6 +86,16 @@ static inline void os_reltime_sub(struct os_reltime *a, struct os_reltime *b, } +static inline void os_reltime_age(struct os_reltime *start, + struct os_reltime *age) +{ + struct os_reltime now; + + os_get_reltime(&now); + os_reltime_sub(&now, start, age); +} + + /** * os_mktime - Convert broken-down time into seconds since 1970-01-01 * @year: Four digit year