[coreboot-gerrit] New patch to review for coreboot: eb8b819 timer.h: add mono_time_diff_microseconds()

David Hendricks (dhendrix@chromium.org) gerrit at coreboot.org
Fri May 3 22:28:15 CEST 2013


David Hendricks (dhendrix at chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3190

-gerrit

commit eb8b8199b803774d5e65ca66d2e54db94bbc5c57
Author: David Hendricks <dhendrix at chromium.org>
Date:   Fri May 3 12:28:11 2013 -0700

    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 at chromium.org>
---
 src/include/timer.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/include/timer.h b/src/include/timer.h
index e950c81..e755a90 100644
--- a/src/include/timer.h
+++ b/src/include/timer.h
@@ -153,6 +153,15 @@ static inline struct rela_time current_time_from(const struct mono_time *t)
 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 */



More information about the coreboot-gerrit mailing list