mirror of
https://gitlab.com/chrony/chrony.git
synced 2026-01-20 21:00:20 -05:00
sys_linux: drop dhz variable
Avoid keeping the system USER_HZ in two variables as an int and a double. The integer value is not really needed. Replace sys_hz with dhz.
This commit is contained in:
13
sys_linux.c
13
sys_linux.c
@@ -94,8 +94,7 @@ static int current_delta_tick;
|
|||||||
static int max_tick_bias;
|
static int max_tick_bias;
|
||||||
|
|
||||||
/* The kernel USER_HZ constant */
|
/* The kernel USER_HZ constant */
|
||||||
static int sys_hz;
|
static double sys_hz;
|
||||||
static double dhz; /* And dbl prec version of same for arithmetic */
|
|
||||||
|
|
||||||
/* The assumed rate at which the effective frequency and tick values are
|
/* The assumed rate at which the effective frequency and tick values are
|
||||||
updated in the kernel */
|
updated in the kernel */
|
||||||
@@ -138,8 +137,8 @@ set_frequency(double freq_ppm)
|
|||||||
double required_freq;
|
double required_freq;
|
||||||
int required_delta_tick;
|
int required_delta_tick;
|
||||||
|
|
||||||
required_delta_tick = round(freq_ppm / dhz);
|
required_delta_tick = round(freq_ppm / sys_hz);
|
||||||
required_freq = -(freq_ppm - dhz * required_delta_tick);
|
required_freq = -(freq_ppm - sys_hz * required_delta_tick);
|
||||||
required_tick = nominal_tick - required_delta_tick;
|
required_tick = nominal_tick - required_delta_tick;
|
||||||
|
|
||||||
txc.modes = ADJ_TICK | ADJ_FREQUENCY;
|
txc.modes = ADJ_TICK | ADJ_FREQUENCY;
|
||||||
@@ -150,7 +149,7 @@ set_frequency(double freq_ppm)
|
|||||||
|
|
||||||
current_delta_tick = required_delta_tick;
|
current_delta_tick = required_delta_tick;
|
||||||
|
|
||||||
return dhz * current_delta_tick - txc.freq / FREQ_SCALE;
|
return sys_hz * current_delta_tick - txc.freq / FREQ_SCALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
@@ -167,7 +166,7 @@ read_frequency(void)
|
|||||||
|
|
||||||
current_delta_tick = nominal_tick - txc.tick;
|
current_delta_tick = nominal_tick - txc.tick;
|
||||||
|
|
||||||
return dhz * current_delta_tick - txc.freq / FREQ_SCALE;
|
return sys_hz * current_delta_tick - txc.freq / FREQ_SCALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
@@ -271,7 +270,7 @@ get_version_specific_details(void)
|
|||||||
hz = guess_hz();
|
hz = guess_hz();
|
||||||
|
|
||||||
sys_hz = hz;
|
sys_hz = hz;
|
||||||
dhz = (double) hz;
|
|
||||||
nominal_tick = (1000000L + (hz/2))/hz; /* Mirror declaration in kernel */
|
nominal_tick = (1000000L + (hz/2))/hz; /* Mirror declaration in kernel */
|
||||||
max_tick_bias = nominal_tick / 10;
|
max_tick_bias = nominal_tick / 10;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user