diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2014-07-16 17:04:29 -0400 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2014-07-23 13:18:04 -0400 |
commit | 897994e32b2b0a41ce4222c3b38a05bd2d1ee9fa (patch) | |
tree | d209ea9455d0770f30d17aecc2ac1b54857d513f | |
parent | dcaab54e348c5b66cca4802815ceebd37059e70c (diff) |
timekeeping: Provide ktime_get[*]_ns() helpers
A lot of code converts either timespecs or ktime_t to
nanoseconds. Provide helper functions.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
-rw-r--r-- | include/linux/timekeeping.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 64c81f367866..903ecc10fcff 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h | |||
@@ -145,6 +145,21 @@ static inline ktime_t ktime_mono_to_real(ktime_t mono) | |||
145 | return ktime_mono_to_any(mono, TK_OFFS_REAL); | 145 | return ktime_mono_to_any(mono, TK_OFFS_REAL); |
146 | } | 146 | } |
147 | 147 | ||
148 | static inline u64 ktime_get_ns(void) | ||
149 | { | ||
150 | return ktime_to_ns(ktime_get()); | ||
151 | } | ||
152 | |||
153 | static inline u64 ktime_get_real_ns(void) | ||
154 | { | ||
155 | return ktime_to_ns(ktime_get_real()); | ||
156 | } | ||
157 | |||
158 | static inline u64 ktime_get_boot_ns(void) | ||
159 | { | ||
160 | return ktime_to_ns(ktime_get_boottime()); | ||
161 | } | ||
162 | |||
148 | /* | 163 | /* |
149 | * RTC specific | 164 | * RTC specific |
150 | */ | 165 | */ |