summaryrefslogtreecommitdiffstats
path: root/src/include/timer.h
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2013-05-03 12:28:11 -0700
committerDavid Hendricks <dhendrix@chromium.org>2013-05-05 23:57:03 +0200
commit040f25b73a9e131d18c2f64a6c3b60e695e3d7d6 (patch)
tree0d173cacb1b1b603bbfd725e842e5ffb65fe9f2f /src/include/timer.h
parent0bb875be5e575b6eceb081d1a92da467b87aa96b (diff)
downloadcoreboot-040f25b73a9e131d18c2f64a6c3b60e695e3d7d6.tar.gz
coreboot-040f25b73a9e131d18c2f64a6c3b60e695e3d7d6.tar.bz2
coreboot-040f25b73a9e131d18c2f64a6c3b60e695e3d7d6.zip
timer.h: add mono_time_diff_microseconds()
The current way to get a simple mono_time difference is: 1. Declare a rela_time struct 2. Assign it the value of mono_time_diff(t1, t2) 3. Get microseconds from it using rela_time_in_microseconds(). This patch adds a simpler method. Now one only needs to call mono_time_diff_microseconds(t1, t2) to obtain the same value which is produced from the above three steps. Change-Id: Ibfc9cd211e48e8e60a0a7703bff09cee3250e88b Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: http://review.coreboot.org/3190 Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/include/timer.h')
-rw-r--r--src/include/timer.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/timer.h b/src/include/timer.h
index e950c81eeeec..c32effe0a2df 100644
--- a/src/include/timer.h
+++ b/src/include/timer.h
@@ -155,4 +155,12 @@ static inline long rela_time_in_microseconds(const struct rela_time *rt)
return rt->microseconds;
}
+static inline long mono_time_diff_microseconds(const struct mono_time *t1,
+ const struct mono_time *t2)
+{
+ struct rela_time rt;
+ rt = mono_time_diff(t1, t2);
+ return rela_time_in_microseconds(&rt);
+}
+
#endif /* TIMER_H */