diff options
Diffstat (limited to 'kernel/time.c')
-rw-r--r-- | kernel/time.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/kernel/time.c b/kernel/time.c index 40c2410ac99a..245d595a13cb 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -338,30 +338,20 @@ int do_adjtimex(struct timex *txc) | |||
338 | if (mtemp >= MINSEC) { | 338 | if (mtemp >= MINSEC) { |
339 | ltemp = (time_offset / mtemp) << (SHIFT_USEC - | 339 | ltemp = (time_offset / mtemp) << (SHIFT_USEC - |
340 | SHIFT_UPDATE); | 340 | SHIFT_UPDATE); |
341 | if (ltemp < 0) | 341 | time_freq += shift_right(ltemp, SHIFT_KH); |
342 | time_freq -= -ltemp >> SHIFT_KH; | ||
343 | else | ||
344 | time_freq += ltemp >> SHIFT_KH; | ||
345 | } else /* calibration interval too short (p. 12) */ | 342 | } else /* calibration interval too short (p. 12) */ |
346 | result = TIME_ERROR; | 343 | result = TIME_ERROR; |
347 | } else { /* PLL mode */ | 344 | } else { /* PLL mode */ |
348 | if (mtemp < MAXSEC) { | 345 | if (mtemp < MAXSEC) { |
349 | ltemp *= mtemp; | 346 | ltemp *= mtemp; |
350 | if (ltemp < 0) | 347 | time_freq += shift_right(ltemp,(time_constant + |
351 | time_freq -= -ltemp >> (time_constant + | ||
352 | time_constant + | ||
353 | SHIFT_KF - SHIFT_USEC); | ||
354 | else | ||
355 | time_freq += ltemp >> (time_constant + | ||
356 | time_constant + | 348 | time_constant + |
357 | SHIFT_KF - SHIFT_USEC); | 349 | SHIFT_KF - SHIFT_USEC)); |
358 | } else /* calibration interval too long (p. 12) */ | 350 | } else /* calibration interval too long (p. 12) */ |
359 | result = TIME_ERROR; | 351 | result = TIME_ERROR; |
360 | } | 352 | } |
361 | if (time_freq > time_tolerance) | 353 | time_freq = min(time_freq, time_tolerance); |
362 | time_freq = time_tolerance; | 354 | time_freq = max(time_freq, -time_tolerance); |
363 | else if (time_freq < -time_tolerance) | ||
364 | time_freq = -time_tolerance; | ||
365 | } /* STA_PLL || STA_PPSTIME */ | 355 | } /* STA_PLL || STA_PPSTIME */ |
366 | } /* txc->modes & ADJ_OFFSET */ | 356 | } /* txc->modes & ADJ_OFFSET */ |
367 | if (txc->modes & ADJ_TICK) { | 357 | if (txc->modes & ADJ_TICK) { |
@@ -384,10 +374,7 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0 | |||
384 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) | 374 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) |
385 | txc->offset = save_adjust; | 375 | txc->offset = save_adjust; |
386 | else { | 376 | else { |
387 | if (time_offset < 0) | 377 | txc->offset = shift_right(time_offset, SHIFT_UPDATE); |
388 | txc->offset = -(-time_offset >> SHIFT_UPDATE); | ||
389 | else | ||
390 | txc->offset = time_offset >> SHIFT_UPDATE; | ||
391 | } | 378 | } |
392 | txc->freq = time_freq + pps_freq; | 379 | txc->freq = time_freq + pps_freq; |
393 | txc->maxerror = time_maxerror; | 380 | txc->maxerror = time_maxerror; |
@@ -532,6 +519,7 @@ int do_settimeofday (struct timespec *tv) | |||
532 | clock_was_set(); | 519 | clock_was_set(); |
533 | return 0; | 520 | return 0; |
534 | } | 521 | } |
522 | EXPORT_SYMBOL(do_settimeofday); | ||
535 | 523 | ||
536 | void do_gettimeofday (struct timeval *tv) | 524 | void do_gettimeofday (struct timeval *tv) |
537 | { | 525 | { |