diff options
Diffstat (limited to 'kernel/time/timekeeping.c')
-rw-r--r-- | kernel/time/timekeeping.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index ab46ae8c062b..092a2366b5a9 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -82,13 +82,12 @@ static inline s64 __get_nsec_offset(void) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * __get_realtime_clock_ts - Returns the time of day in a timespec | 85 | * getnstimeofday - Returns the time of day in a timespec |
86 | * @ts: pointer to the timespec to be set | 86 | * @ts: pointer to the timespec to be set |
87 | * | 87 | * |
88 | * Returns the time of day in a timespec. Used by | 88 | * Returns the time of day in a timespec. |
89 | * do_gettimeofday() and get_realtime_clock_ts(). | ||
90 | */ | 89 | */ |
91 | static inline void __get_realtime_clock_ts(struct timespec *ts) | 90 | void getnstimeofday(struct timespec *ts) |
92 | { | 91 | { |
93 | unsigned long seq; | 92 | unsigned long seq; |
94 | s64 nsecs; | 93 | s64 nsecs; |
@@ -104,30 +103,19 @@ static inline void __get_realtime_clock_ts(struct timespec *ts) | |||
104 | timespec_add_ns(ts, nsecs); | 103 | timespec_add_ns(ts, nsecs); |
105 | } | 104 | } |
106 | 105 | ||
107 | /** | ||
108 | * getnstimeofday - Returns the time of day in a timespec | ||
109 | * @ts: pointer to the timespec to be set | ||
110 | * | ||
111 | * Returns the time of day in a timespec. | ||
112 | */ | ||
113 | void getnstimeofday(struct timespec *ts) | ||
114 | { | ||
115 | __get_realtime_clock_ts(ts); | ||
116 | } | ||
117 | |||
118 | EXPORT_SYMBOL(getnstimeofday); | 106 | EXPORT_SYMBOL(getnstimeofday); |
119 | 107 | ||
120 | /** | 108 | /** |
121 | * do_gettimeofday - Returns the time of day in a timeval | 109 | * do_gettimeofday - Returns the time of day in a timeval |
122 | * @tv: pointer to the timeval to be set | 110 | * @tv: pointer to the timeval to be set |
123 | * | 111 | * |
124 | * NOTE: Users should be converted to using get_realtime_clock_ts() | 112 | * NOTE: Users should be converted to using getnstimeofday() |
125 | */ | 113 | */ |
126 | void do_gettimeofday(struct timeval *tv) | 114 | void do_gettimeofday(struct timeval *tv) |
127 | { | 115 | { |
128 | struct timespec now; | 116 | struct timespec now; |
129 | 117 | ||
130 | __get_realtime_clock_ts(&now); | 118 | getnstimeofday(&now); |
131 | tv->tv_sec = now.tv_sec; | 119 | tv->tv_sec = now.tv_sec; |
132 | tv->tv_usec = now.tv_nsec/1000; | 120 | tv->tv_usec = now.tv_nsec/1000; |
133 | } | 121 | } |
@@ -198,7 +186,8 @@ static void change_clocksource(void) | |||
198 | 186 | ||
199 | clock->error = 0; | 187 | clock->error = 0; |
200 | clock->xtime_nsec = 0; | 188 | clock->xtime_nsec = 0; |
201 | clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH); | 189 | clocksource_calculate_interval(clock, |
190 | (unsigned long)(current_tick_length()>>TICK_LENGTH_SHIFT)); | ||
202 | 191 | ||
203 | tick_clock_notify(); | 192 | tick_clock_notify(); |
204 | 193 | ||
@@ -255,7 +244,8 @@ void __init timekeeping_init(void) | |||
255 | ntp_clear(); | 244 | ntp_clear(); |
256 | 245 | ||
257 | clock = clocksource_get_next(); | 246 | clock = clocksource_get_next(); |
258 | clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH); | 247 | clocksource_calculate_interval(clock, |
248 | (unsigned long)(current_tick_length()>>TICK_LENGTH_SHIFT)); | ||
259 | clock->cycle_last = clocksource_read(clock); | 249 | clock->cycle_last = clocksource_read(clock); |
260 | 250 | ||
261 | xtime.tv_sec = sec; | 251 | xtime.tv_sec = sec; |