Commit 02cba159 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by John Stultz

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: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 48f18fd6
...@@ -1525,14 +1525,9 @@ void update_wall_time(void) ...@@ -1525,14 +1525,9 @@ void update_wall_time(void)
void getboottime(struct timespec *ts) void getboottime(struct timespec *ts)
{ {
struct timekeeper *tk = &tk_core.timekeeper; struct timekeeper *tk = &tk_core.timekeeper;
struct timespec boottime = { ktime_t t = ktime_sub(tk->offs_real, tk->offs_boot);
.tv_sec = tk->wall_to_monotonic.tv_sec +
tk->total_sleep_time.tv_sec, *ts = ktime_to_timespec(t);
.tv_nsec = tk->wall_to_monotonic.tv_nsec +
tk->total_sleep_time.tv_nsec
};
set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec);
} }
EXPORT_SYMBOL_GPL(getboottime); EXPORT_SYMBOL_GPL(getboottime);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment