[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <33ad31f2dbcb7613dec1b44c9a5e23ef38fe76bc.1434079262.git.baolin.wang@linaro.org>
Date: Fri, 12 Jun 2015 15:30:32 +0800
From: Baolin Wang <baolin.wang@...aro.org>
To: tglx@...utronix.de
Cc: arnd@...db.de, john.stultz@...aro.org, pang.xunlei@...aro.org,
mingo@...nel.org, peterz@...radead.org,
linux-kernel@...r.kernel.org, baolin.wang@...aro.org,
y2038@...ts.linaro.org
Subject: [PATCH v5 02/24] timekeeping: Introduce current_kernel_time64()
The current_kernel_time() is not year 2038 safe on 32bit systems
due to return timespec value. Introduce current_kernel_time64()
function which returns timespec64 value, also as a helper function
calling by current_kernel_time().
Signed-off-by: Baolin Wang <baolin.wang@...aro.org>
---
include/linux/timekeeping.h | 10 +++++++++-
kernel/time/timekeeping.c | 6 +++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 3aa72e6..f886bdb 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -18,10 +18,18 @@ extern int do_sys_settimeofday(const struct timespec *tv,
* Kernel time accessors
*/
unsigned long get_seconds(void);
-struct timespec current_kernel_time(void);
+struct timespec64 current_kernel_time64(void);
/* does not take xtime_lock */
struct timespec __current_kernel_time(void);
+static inline struct timespec current_kernel_time(void)
+{
+ struct timespec64 now = current_kernel_time64();
+
+ return timespec64_to_timespec(now);
+}
+
/*
* timespec based interfaces
*/
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 0d784b3..5fe9b77 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1857,7 +1857,7 @@ struct timespec __current_kernel_time(void)
return timespec64_to_timespec(tk_xtime(tk));
}
-struct timespec current_kernel_time(void)
+struct timespec64 current_kernel_time64(void)
{
struct timekeeper *tk = &tk_core.timekeeper;
struct timespec64 now;
@@ -1869,9 +1869,9 @@ struct timespec current_kernel_time(void)
now = tk_xtime(tk);
} while (read_seqcount_retry(&tk_core.seq, seq));
- return timespec64_to_timespec(now);
+ return now;
}
-EXPORT_SYMBOL(current_kernel_time);
+EXPORT_SYMBOL(current_kernel_time64);
struct timespec64 get_monotonic_coarse64(void)
{
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists