aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/time.h18
-rw-r--r--kernel/hrtimer.c4
-rw-r--r--kernel/time.c4
3 files changed, 10 insertions, 16 deletions
diff --git a/include/linux/time.h b/include/linux/time.h
index bf0e785e2e03..0cd696cee998 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -73,12 +73,6 @@ extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
73#define timespec_valid(ts) \ 73#define timespec_valid(ts) \
74 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) 74 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC))
75 75
76/*
77 * 64-bit nanosec type. Large enough to span 292+ years in nanosecond
78 * resolution. Ought to be enough for a while.
79 */
80typedef s64 nsec_t;
81
82extern struct timespec xtime; 76extern struct timespec xtime;
83extern struct timespec wall_to_monotonic; 77extern struct timespec wall_to_monotonic;
84extern seqlock_t xtime_lock; 78extern seqlock_t xtime_lock;
@@ -114,9 +108,9 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
114 * Returns the scalar nanosecond representation of the timespec 108 * Returns the scalar nanosecond representation of the timespec
115 * parameter. 109 * parameter.
116 */ 110 */
117static inline nsec_t timespec_to_ns(const struct timespec *ts) 111static inline s64 timespec_to_ns(const struct timespec *ts)
118{ 112{
119 return ((nsec_t) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; 113 return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;
120} 114}
121 115
122/** 116/**
@@ -126,9 +120,9 @@ static inline nsec_t timespec_to_ns(const struct timespec *ts)
126 * Returns the scalar nanosecond representation of the timeval 120 * Returns the scalar nanosecond representation of the timeval
127 * parameter. 121 * parameter.
128 */ 122 */
129static inline nsec_t timeval_to_ns(const struct timeval *tv) 123static inline s64 timeval_to_ns(const struct timeval *tv)
130{ 124{
131 return ((nsec_t) tv->tv_sec * NSEC_PER_SEC) + 125 return ((s64) tv->tv_sec * NSEC_PER_SEC) +
132 tv->tv_usec * NSEC_PER_USEC; 126 tv->tv_usec * NSEC_PER_USEC;
133} 127}
134 128
@@ -138,7 +132,7 @@ static inline nsec_t timeval_to_ns(const struct timeval *tv)
138 * 132 *
139 * Returns the timespec representation of the nsec parameter. 133 * Returns the timespec representation of the nsec parameter.
140 */ 134 */
141extern struct timespec ns_to_timespec(const nsec_t nsec); 135extern struct timespec ns_to_timespec(const s64 nsec);
142 136
143/** 137/**
144 * ns_to_timeval - Convert nanoseconds to timeval 138 * ns_to_timeval - Convert nanoseconds to timeval
@@ -146,7 +140,7 @@ extern struct timespec ns_to_timespec(const nsec_t nsec);
146 * 140 *
147 * Returns the timeval representation of the nsec parameter. 141 * Returns the timeval representation of the nsec parameter.
148 */ 142 */
149extern struct timeval ns_to_timeval(const nsec_t nsec); 143extern struct timeval ns_to_timeval(const s64 nsec);
150 144
151#endif /* __KERNEL__ */ 145#endif /* __KERNEL__ */
152 146
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 658d49feedb9..44108de4f028 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -266,7 +266,7 @@ ktime_t ktime_add_ns(const ktime_t kt, u64 nsec)
266/* 266/*
267 * Divide a ktime value by a nanosecond value 267 * Divide a ktime value by a nanosecond value
268 */ 268 */
269static unsigned long ktime_divns(const ktime_t kt, nsec_t div) 269static unsigned long ktime_divns(const ktime_t kt, s64 div)
270{ 270{
271 u64 dclc, inc, dns; 271 u64 dclc, inc, dns;
272 int sft = 0; 272 int sft = 0;
@@ -322,7 +322,7 @@ hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
322 interval.tv64 = timer->base->resolution.tv64; 322 interval.tv64 = timer->base->resolution.tv64;
323 323
324 if (unlikely(delta.tv64 >= interval.tv64)) { 324 if (unlikely(delta.tv64 >= interval.tv64)) {
325 nsec_t incr = ktime_to_ns(interval); 325 s64 incr = ktime_to_ns(interval);
326 326
327 orun = ktime_divns(delta, incr); 327 orun = ktime_divns(delta, incr);
328 timer->expires = ktime_add_ns(timer->expires, incr * orun); 328 timer->expires = ktime_add_ns(timer->expires, incr * orun);
diff --git a/kernel/time.c b/kernel/time.c
index e00a97b77241..ff8e7019c4c4 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -610,7 +610,7 @@ void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec)
610 * 610 *
611 * Returns the timespec representation of the nsec parameter. 611 * Returns the timespec representation of the nsec parameter.
612 */ 612 */
613struct timespec ns_to_timespec(const nsec_t nsec) 613struct timespec ns_to_timespec(const s64 nsec)
614{ 614{
615 struct timespec ts; 615 struct timespec ts;
616 616
@@ -630,7 +630,7 @@ struct timespec ns_to_timespec(const nsec_t nsec)
630 * 630 *
631 * Returns the timeval representation of the nsec parameter. 631 * Returns the timeval representation of the nsec parameter.
632 */ 632 */
633struct timeval ns_to_timeval(const nsec_t nsec) 633struct timeval ns_to_timeval(const s64 nsec)
634{ 634{
635 struct timespec ts = ns_to_timespec(nsec); 635 struct timespec ts = ns_to_timespec(nsec);
636 struct timeval tv; 636 struct timeval tv;