[PATCH 1/8] OS utils: provide os_reltime_age()

Johannes Berg johannes
Mon Nov 25 12:56:02 PST 2013


From: Johannes Berg <johannes.berg at intel.com>

This function calculates and returns the time passed since
a given timestamp.

Signed-hostap: Johannes Berg <johannes.berg at intel.com>
---
 src/utils/os.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

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
-- 
1.8.4.rc3




More information about the Hostap mailing list