lkml.org 
[lkml]   [2014]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch V2 47/64] 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>
---
kernel/time/timekeeping.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

Index: tip/kernel/time/timekeeping.c
===================================================================
--- tip.orig/kernel/time/timekeeping.c
+++ tip/kernel/time/timekeeping.c
@@ -1525,14 +1525,9 @@ out:
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);




\
 
 \ /
  Last update: 2014-07-17 05:21    [W:0.396 / U:0.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site