diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-07-16 17:04:58 -0400 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2014-07-23 18:01:47 -0400 |
commit | 02cba1598a2a3b689e79ad6dad2532521f638271 (patch) | |
tree | c63b4bded9f6c6194d1c13947c8c30611e9f2b30 /kernel/time | |
parent | 48f18fd6addc199f330d838d54fe7b0a0892adaa (diff) |
timekeeping: Simplify getboottime()
Subtracting plain nsec values and converting to timespec is simpler
than the whole timespec math. Not really fastpath code, so the
division is not an issue.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/timekeeping.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index f63476fb0daf..3edc0c1d6fe8 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -1525,14 +1525,9 @@ out: | |||
1525 | void getboottime(struct timespec *ts) | 1525 | void getboottime(struct timespec *ts) |
1526 | { | 1526 | { |
1527 | struct timekeeper *tk = &tk_core.timekeeper; | 1527 | struct timekeeper *tk = &tk_core.timekeeper; |
1528 | struct timespec boottime = { | 1528 | ktime_t t = ktime_sub(tk->offs_real, tk->offs_boot); |
1529 | .tv_sec = tk->wall_to_monotonic.tv_sec + | 1529 | |
1530 | tk->total_sleep_time.tv_sec, | 1530 | *ts = ktime_to_timespec(t); |
1531 | .tv_nsec = tk->wall_to_monotonic.tv_nsec + | ||
1532 | tk->total_sleep_time.tv_nsec | ||
1533 | }; | ||
1534 | |||
1535 | set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec); | ||
1536 | } | 1531 | } |
1537 | EXPORT_SYMBOL_GPL(getboottime); | 1532 | EXPORT_SYMBOL_GPL(getboottime); |
1538 | 1533 | ||