提交 8758a240 编写于 作者: B Baolin Wang 提交者: John Stultz

time: Introduce current_kernel_time64()

The current_kernel_time() is not year 2038 safe on 32bit systems
since it returns a timespec value. Introduce current_kernel_time64()
which returns a timespec64 value.

Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: NBaolin Wang <baolin.wang@linaro.org>
Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
上级 19a46fe5
...@@ -18,10 +18,17 @@ extern int do_sys_settimeofday(const struct timespec *tv, ...@@ -18,10 +18,17 @@ extern int do_sys_settimeofday(const struct timespec *tv,
* Kernel time accessors * Kernel time accessors
*/ */
unsigned long get_seconds(void); unsigned long get_seconds(void);
struct timespec current_kernel_time(void); struct timespec64 current_kernel_time64(void);
/* does not take xtime_lock */ /* does not take xtime_lock */
struct timespec __current_kernel_time(void); 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 * timespec based interfaces
*/ */
......
...@@ -1881,7 +1881,7 @@ struct timespec __current_kernel_time(void) ...@@ -1881,7 +1881,7 @@ struct timespec __current_kernel_time(void)
return timespec64_to_timespec(tk_xtime(tk)); 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 timekeeper *tk = &tk_core.timekeeper;
struct timespec64 now; struct timespec64 now;
...@@ -1893,9 +1893,9 @@ struct timespec current_kernel_time(void) ...@@ -1893,9 +1893,9 @@ struct timespec current_kernel_time(void)
now = tk_xtime(tk); now = tk_xtime(tk);
} while (read_seqcount_retry(&tk_core.seq, seq)); } 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) struct timespec64 get_monotonic_coarse64(void)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册