Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 87066
b: refs/heads/master
c: 10a398d
h: refs/heads/master
v: v3
  • Loading branch information
Roman Zippel authored and Thomas Gleixner committed Mar 9, 2008
1 parent 41ac977 commit 2f9f08b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a79017660ea4597ec489fab3b5aaf71dd776dfc7
refs/heads/master: 10a398d04c4a1fc395840f4d040493375f562302
9 changes: 1 addition & 8 deletions trunk/include/linux/timex.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,7 @@ static inline int ntp_synced(void)
#else
#define NTP_INTERVAL_FREQ (HZ)
#endif

#define CLOCK_TICK_OVERFLOW (LATCH * HZ - CLOCK_TICK_RATE)
#define CLOCK_TICK_ADJUST (((s64)CLOCK_TICK_OVERFLOW * NSEC_PER_SEC) / \
(s64)CLOCK_TICK_RATE)

/* Because using NSEC_PER_SEC would be too easy */
#define NTP_INTERVAL_LENGTH ((((s64)TICK_USEC * NSEC_PER_USEC * USER_HZ) + \
CLOCK_TICK_ADJUST) / NTP_INTERVAL_FREQ)
#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)

/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
extern u64 current_tick_length(void);
Expand Down
11 changes: 10 additions & 1 deletion trunk/kernel/time/ntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */
long time_freq; /* frequency offset (scaled ppm)*/
static long time_reftime; /* time at last adjustment (s) */
long time_adjust;
static long ntp_tick_adj;

static void ntp_update_frequency(void)
{
u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ)
<< TICK_LENGTH_SHIFT;
second_length += (s64)CLOCK_TICK_ADJUST << TICK_LENGTH_SHIFT;
second_length += (s64)ntp_tick_adj << TICK_LENGTH_SHIFT;
second_length += (s64)time_freq << (TICK_LENGTH_SHIFT - SHIFT_NSEC);

tick_length_base = second_length;
Expand Down Expand Up @@ -402,3 +403,11 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0)
notify_cmos_timer();
return(result);
}

static int __init ntp_tick_adj_setup(char *str)
{
ntp_tick_adj = simple_strtol(str, NULL, 0);
return 1;
}

__setup("ntp_tick_adj=", ntp_tick_adj_setup);
6 changes: 2 additions & 4 deletions trunk/kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ static void change_clocksource(void)

clock->error = 0;
clock->xtime_nsec = 0;
clocksource_calculate_interval(clock,
(unsigned long)(current_tick_length()>>TICK_LENGTH_SHIFT));
clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH);

tick_clock_notify();

Expand Down Expand Up @@ -245,8 +244,7 @@ void __init timekeeping_init(void)
ntp_clear();

clock = clocksource_get_next();
clocksource_calculate_interval(clock,
(unsigned long)(current_tick_length()>>TICK_LENGTH_SHIFT));
clocksource_calculate_interval(clock, NTP_INTERVAL_LENGTH);
clock->cycle_last = clocksource_read(clock);

xtime.tv_sec = sec;
Expand Down

0 comments on commit 2f9f08b

Please sign in to comment.