aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-11-25 20:56:02 (GMT)
committerJouni Malinen <j@w1.fi>2013-12-08 02:55:58 (GMT)
commited0ebee14f584f5cf536e9dc54bfd9ae9424c947 (patch)
tree06741e3d5ef56a21cc37ebcb7841a6e8216dbd3f /src/utils
parent8567866d75fcbe031c308194d8868d9c68bd6bf2 (diff)
downloadhostap-ed0ebee14f584f5cf536e9dc54bfd9ae9424c947.zip
hostap-ed0ebee14f584f5cf536e9dc54bfd9ae9424c947.tar.gz
hostap-ed0ebee14f584f5cf536e9dc54bfd9ae9424c947.tar.bz2
OS utils: Provide os_reltime_age()
This function calculates and returns the time passed since a given timestamp. Signed-hostap: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/os.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils/os.h b/src/utils/os.h
index 77dc6e3..6689d44 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