Skip to content

Commit

Permalink
[MIPS] Use USECS_PER_SEC / HZ instead of tick_usec in do_gettimeofday.
Browse files Browse the repository at this point in the history
    
The 'tick_usec' is USER_HZ period in usec.  do_gettimeofday() should
use kernel HZ value.
    
Here is a patch for MIPS.  It seems m32r, m68k and sparc have same
problem though their HZ and USER_HZ are same for now.
    
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
atsushi-nemoto authored and ralfbaechle committed Mar 1, 2006
1 parent 71efa38 commit 800d114
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/mips/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void do_gettimeofday(struct timeval *tv)
unsigned long seq;
unsigned long lost;
unsigned long usec, sec;
unsigned long max_ntp_tick = tick_usec - tickadj;
unsigned long max_ntp_tick;

do {
seq = read_seqbegin(&xtime_lock);
Expand All @@ -178,12 +178,13 @@ void do_gettimeofday(struct timeval *tv)
* Better to lose some accuracy than have time go backwards..
*/
if (unlikely(time_adjust < 0)) {
max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj;
usec = min(usec, max_ntp_tick);

if (lost)
usec += lost * max_ntp_tick;
} else if (unlikely(lost))
usec += lost * tick_usec;
usec += lost * (USEC_PER_SEC / HZ);

sec = xtime.tv_sec;
usec += (xtime.tv_nsec / 1000);
Expand Down

0 comments on commit 800d114

Please sign in to comment.