summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorHector Palacios <hector.palacios@digi.com>2011-11-11 18:33:32 +0100
committerHector Palacios <hector.palacios@digi.com>2011-11-14 10:25:46 +0100
commita317a9236bbe8b0de8f0d45143b21fed941d4a4e (patch)
treedbde2079c4dc09d1422f83a4fa3c652518d95565 /kernel
parentc92d8b2d0438f59faa867861309927d633dd2019 (diff)
timekeeping: add arch_offset hook to ktime_get functions
ktime_get and ktime_get_ts were calling timekeeping_get_ns() but later they were not calling arch_gettimeoffset() so architectures using this mechanism returned 0 when calling these functions. This happened for example when running Busybox's ping (the returned travel time was zero). Signed-off-by: Hector Palacios <hector.palacios@digi.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/timekeeping.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index caf8d4d4f5c8..5fa8372e9379 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -246,6 +246,8 @@ ktime_t ktime_get(void)
secs = xtime.tv_sec + wall_to_monotonic.tv_sec;
nsecs = xtime.tv_nsec + wall_to_monotonic.tv_nsec;
nsecs += timekeeping_get_ns();
+ /* If arch requires, add in gettimeoffset() */
+ nsecs += arch_gettimeoffset();
} while (read_seqretry(&xtime_lock, seq));
/*
@@ -277,6 +279,8 @@ void ktime_get_ts(struct timespec *ts)
*ts = xtime;
tomono = wall_to_monotonic;
nsecs = timekeeping_get_ns();
+ /* If arch requires, add in gettimeoffset() */
+ nsecs += arch_gettimeoffset();
} while (read_seqretry(&xtime_lock, seq));