Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -1525,14 +1525,9 @@ void update_wall_time(void)
void getboottime(struct timespec *ts)
{
	struct timekeeper *tk = &tk_core.timekeeper;
	struct timespec boottime = {
		.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
	};
	ktime_t t = ktime_sub(tk->offs_real, tk->offs_boot);

	set_normalized_timespec(ts, -boottime.tv_sec, -boottime.tv_nsec);
	*ts = ktime_to_timespec(t);
}
EXPORT_SYMBOL_GPL(getboottime);