summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-07-16 21:05:04 +0000
committerJohn Stultz <john.stultz@linaro.org>2014-07-23 15:01:49 -0700
commitf519b1a2e08c913375324a927992bb328387f169 (patch)
tree0a4ccfd703fc4bed1da94cf9f1ed355f0eda0a60 /include
parent2044fdb03eb4e511d5028be0917899931f17461f (diff)
timekeeping: Provide ktime_get_raw()
Provide a ktime_t based interface for raw monotonic time. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/timekeeper_internal.h3
-rw-r--r--include/linux/timekeeping.h6
2 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h
index 8e5d77a01787..2e20275a7083 100644
--- a/include/linux/timekeeper_internal.h
+++ b/include/linux/timekeeper_internal.h
@@ -54,6 +54,9 @@ struct timekeeper {
/* The current UTC to TAI offset in seconds */
s32 tai_offset;
+ /* Monotonic raw base time */
+ ktime_t base_raw;
+
/* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */
struct timespec64 raw_time;
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index f0f12a84a31b..58ad7eff83ff 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -107,6 +107,7 @@ enum tk_offsets {
extern ktime_t ktime_get(void);
extern ktime_t ktime_get_with_offset(enum tk_offsets offs);
extern ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs);
+extern ktime_t ktime_get_raw(void);
/**
* ktime_get_real - get the real (wall-) time in ktime_t format
@@ -158,6 +159,11 @@ static inline u64 ktime_get_boot_ns(void)
return ktime_to_ns(ktime_get_boottime());
}
+static inline u64 ktime_get_raw_ns(void)
+{
+ return ktime_to_ns(ktime_get_raw());
+}
+
/*
* Timespec interfaces utilizing the ktime based ones
*/