clockadj: Remove clkid parameter from set_leap function.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
master
Miroslav Lichvar 2013-04-08 15:44:09 +02:00 committed by Richard Cochran
parent 24c4e851fc
commit 7b162c4821
4 changed files with 8 additions and 8 deletions

View File

@ -508,7 +508,7 @@ static int clock_utc_correct(struct clock *c, tmv_t ingress)
&leap, &utc_offset); &leap, &utc_offset);
if (c->leap_set != clock_leap) { if (c->leap_set != clock_leap) {
if (c->kernel_leap) if (c->kernel_leap)
clockadj_set_leap(c->clkid, clock_leap); sysclk_set_leap(clock_leap);
c->leap_set = clock_leap; c->leap_set = clock_leap;
} }
} }
@ -593,7 +593,7 @@ struct clock *clock_create(int phc_index, struct interface *iface, int count,
c->clkid = CLOCK_REALTIME; c->clkid = CLOCK_REALTIME;
c->utc_timescale = 1; c->utc_timescale = 1;
max_adj = sysclk_max_freq(); max_adj = sysclk_max_freq();
clockadj_set_leap(c->clkid, 0); sysclk_set_leap(0);
} }
c->leap_set = 0; c->leap_set = 0;
c->kernel_leap = dds->kernel_leap; c->kernel_leap = dds->kernel_leap;

View File

@ -71,8 +71,9 @@ void clockadj_step(clockid_t clkid, int64_t step)
pr_err("failed to step clock: %m"); pr_err("failed to step clock: %m");
} }
void clockadj_set_leap(clockid_t clkid, int leap) void sysclk_set_leap(int leap)
{ {
clockid_t clkid = CLOCK_REALTIME;
struct timex tx; struct timex tx;
const char *m = NULL; const char *m = NULL;
memset(&tx, 0, sizeof(tx)); memset(&tx, 0, sizeof(tx));

View File

@ -45,12 +45,11 @@ double clockadj_get_freq(clockid_t clkid);
void clockadj_step(clockid_t clkid, int64_t step); void clockadj_step(clockid_t clkid, int64_t step);
/** /**
* Insert/delete leap second at midnight. * Set the system clock to insert/delete leap second at midnight.
* @param clkid CLOCK_REALTIME.
* @param leap +1 to insert leap second, -1 to delete leap second, * @param leap +1 to insert leap second, -1 to delete leap second,
* 0 to reset the leap state. * 0 to reset the leap state.
*/ */
void clockadj_set_leap(clockid_t clkid, int leap); void sysclk_set_leap(int leap);
/** /**
* Read maximum frequency adjustment of the system clock (CLOCK_REALTIME). * Read maximum frequency adjustment of the system clock (CLOCK_REALTIME).

View File

@ -502,7 +502,7 @@ static int update_sync_offset(struct clock *clock, int64_t offset, uint64_t ts)
if (clock->leap_set != clock_leap) { if (clock->leap_set != clock_leap) {
/* Only the system clock can leap. */ /* Only the system clock can leap. */
if (clock->clkid == CLOCK_REALTIME && clock->kernel_leap) if (clock->clkid == CLOCK_REALTIME && clock->kernel_leap)
clockadj_set_leap(clock->clkid, clock_leap); sysclk_set_leap(clock_leap);
clock->leap_set = clock_leap; clock->leap_set = clock_leap;
} }
@ -702,8 +702,8 @@ int main(int argc, char *argv[])
/* The reading may silently fail and return 0, reset the frequency to /* The reading may silently fail and return 0, reset the frequency to
make sure ppb is the actual frequency of the clock. */ make sure ppb is the actual frequency of the clock. */
clockadj_set_freq(dst_clock.clkid, ppb); clockadj_set_freq(dst_clock.clkid, ppb);
clockadj_set_leap(dst_clock.clkid, 0);
if (dst_clock.clkid == CLOCK_REALTIME) { if (dst_clock.clkid == CLOCK_REALTIME) {
sysclk_set_leap(0);
max_ppb = sysclk_max_freq(); max_ppb = sysclk_max_freq();
} else { } else {
max_ppb = phc_max_adj(dst_clock.clkid); max_ppb = phc_max_adj(dst_clock.clkid);