mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
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>
This commit is contained in:
parent
48f18fd6ad
commit
02cba1598a
@ -1525,14 +1525,9 @@ out:
|
|||||||
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,
|
|
||||||
.tv_nsec = tk->wall_to_monotonic.tv_nsec +
|
|
||||||
tk->total_sleep_time.tv_nsec
|
|
||||||
};
|
|
||||||
|
|
||||||
set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec);
|
*ts = ktime_to_timespec(t);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(getboottime);
|
EXPORT_SYMBOL_GPL(getboottime);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user