From 9e80e27d3874b1eebe06ef90e9af16f0b07ec180 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 1 May 2015 16:48:54 -0500 Subject: timestamp: provide weak default implementation of timestamp_get Change-Id: I2e7f17a686f6af3426c9d68cd9394e9a88dbf358 Signed-off-by: Aaron Durbin Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/10104 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel --- src/lib/timestamp.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/lib/timestamp.c') diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c index 9a0e631b0b..0c9c884942 100644 --- a/src/lib/timestamp.c +++ b/src/lib/timestamp.c @@ -174,3 +174,14 @@ void timestamp_reinit(void) /* Call timestamp_reinit at CAR migration time. */ CAR_MIGRATE(timestamp_reinit) + +/* Provide default timestamp implementation using monotonic timer. */ +uint64_t __attribute__((weak)) timestamp_get(void) +{ + struct mono_time t1, t2; + + mono_time_set_usecs(&t1, 0); + timer_monotonic_get(&t2); + + return mono_time_diff_microseconds(&t1, &t2); +} -- cgit v1.2.3