Messages in this thread Patch in this message | | | From | Baolin Wang <> | Subject | [PATCH v5 16/24] timekeeping: Change the implementation of timekeeping_clocktai() | Date | Fri, 12 Jun 2015 15:53:58 +0800 |
| |
The timekeeping_clocktai() function is not year 2038 safe on 32bit systems, change its implementation with using struct timespec64.
Signed-off-by: Baolin Wang <baolin.wang@linaro.org> --- include/linux/timekeeping.h | 4 ++-- kernel/time/posix-timers.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 2dcc86b..07581c0 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -256,9 +256,9 @@ static inline void get_monotonic_boottime64(struct timespec64 *ts) *ts = ktime_to_timespec64(ktime_get_boottime()); } -static inline void timekeeping_clocktai(struct timespec *ts) +static inline void timekeeping_clocktai(struct timespec64 *ts) { - *ts = ktime_to_timespec(ktime_get_clocktai()); + *ts = ktime_to_timespec64(ktime_get_clocktai()); } /* diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 0b0663a..029a2b6 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -296,7 +296,7 @@ static int posix_get_boottime(const clockid_t which_clock, struct timespec *tp) return 0; } -static int posix_get_tai(clockid_t which_clock, struct timespec *tp) +static int posix_get_tai(clockid_t which_clock, struct timespec64 *tp) { timekeeping_clocktai(tp); return 0; @@ -350,7 +350,7 @@ static __init int init_posix_timers(void) }; struct k_clock clock_tai = { .clock_getres = posix_get_hrtimer_res, - .clock_get = posix_get_tai, + .clock_get64 = posix_get_tai, .nsleep = common_nsleep, .nsleep_restart = hrtimer_nanosleep_restart, .timer_create = common_timer_create, -- 1.7.9.5
| |