mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 11:35:08 -05:00
tempcomp: use macro to set maximum allowed compensation
This commit is contained in:
@@ -35,6 +35,9 @@
|
|||||||
#include "sched.h"
|
#include "sched.h"
|
||||||
#include "tempcomp.h"
|
#include "tempcomp.h"
|
||||||
|
|
||||||
|
/* Sanity limit (in ppm) */
|
||||||
|
#define MAX_COMP 10.0
|
||||||
|
|
||||||
static SCH_TimeoutID timeout_id;
|
static SCH_TimeoutID timeout_id;
|
||||||
|
|
||||||
static LOG_FileID logfileid;
|
static LOG_FileID logfileid;
|
||||||
@@ -54,8 +57,7 @@ read_timeout(void *arg)
|
|||||||
if (f && fscanf(f, "%lf", &temp) == 1) {
|
if (f && fscanf(f, "%lf", &temp) == 1) {
|
||||||
comp = k0 + (temp - T0) * k1 + (temp - T0) * (temp - T0) * k2;
|
comp = k0 + (temp - T0) * k1 + (temp - T0) * (temp - T0) * k2;
|
||||||
|
|
||||||
/* Don't allow corrections above 10 ppm */
|
if (fabs(comp) <= MAX_COMP) {
|
||||||
if (fabs(comp) < 10.0) {
|
|
||||||
comp = LCL_SetTempComp(comp);
|
comp = LCL_SetTempComp(comp);
|
||||||
|
|
||||||
if (logfileid != -1) {
|
if (logfileid != -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user