local: return status from offset accumulation
Change the functions accumulating offset to return success or failure.
This commit is contained in:
parent
53501b743f
commit
e86b60a9d7
2 changed files with 10 additions and 6 deletions
12
local.c
12
local.c
|
@ -505,7 +505,7 @@ LCL_AccumulateDeltaFrequency(double dfreq)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
void
|
int
|
||||||
LCL_AccumulateOffset(double offset, double corr_rate)
|
LCL_AccumulateOffset(double offset, double corr_rate)
|
||||||
{
|
{
|
||||||
struct timespec raw, cooked;
|
struct timespec raw, cooked;
|
||||||
|
@ -517,12 +517,14 @@ LCL_AccumulateOffset(double offset, double corr_rate)
|
||||||
LCL_CookTime(&raw, &cooked, NULL);
|
LCL_CookTime(&raw, &cooked, NULL);
|
||||||
|
|
||||||
if (!check_offset(&cooked, offset))
|
if (!check_offset(&cooked, offset))
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
(*drv_accrue_offset)(offset, corr_rate);
|
(*drv_accrue_offset)(offset, corr_rate);
|
||||||
|
|
||||||
/* Dispatch to all handlers */
|
/* Dispatch to all handlers */
|
||||||
invoke_parameter_change_handlers(&raw, &cooked, 0.0, offset, LCL_ChangeAdjust);
|
invoke_parameter_change_handlers(&raw, &cooked, 0.0, offset, LCL_ChangeAdjust);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
@ -586,7 +588,7 @@ LCL_NotifyLeap(int leap)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
void
|
int
|
||||||
LCL_AccumulateFrequencyAndOffset(double dfreq, double doffset, double corr_rate)
|
LCL_AccumulateFrequencyAndOffset(double dfreq, double doffset, double corr_rate)
|
||||||
{
|
{
|
||||||
struct timespec raw, cooked;
|
struct timespec raw, cooked;
|
||||||
|
@ -598,7 +600,7 @@ LCL_AccumulateFrequencyAndOffset(double dfreq, double doffset, double corr_rate)
|
||||||
LCL_CookTime(&raw, &cooked, NULL);
|
LCL_CookTime(&raw, &cooked, NULL);
|
||||||
|
|
||||||
if (!check_offset(&cooked, doffset))
|
if (!check_offset(&cooked, doffset))
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
old_freq_ppm = current_freq_ppm;
|
old_freq_ppm = current_freq_ppm;
|
||||||
|
|
||||||
|
@ -620,6 +622,8 @@ LCL_AccumulateFrequencyAndOffset(double dfreq, double doffset, double corr_rate)
|
||||||
|
|
||||||
/* Dispatch to all handlers */
|
/* Dispatch to all handlers */
|
||||||
invoke_parameter_change_handlers(&raw, &cooked, dfreq, doffset, LCL_ChangeAdjust);
|
invoke_parameter_change_handlers(&raw, &cooked, dfreq, doffset, LCL_ChangeAdjust);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
4
local.h
4
local.h
|
@ -149,7 +149,7 @@ extern void LCL_AccumulateDeltaFrequency(double dfreq);
|
||||||
forwards (i.e. it is currently slow of true time). Provided is also
|
forwards (i.e. it is currently slow of true time). Provided is also
|
||||||
a suggested correction rate (correction time * offset). */
|
a suggested correction rate (correction time * offset). */
|
||||||
|
|
||||||
extern void LCL_AccumulateOffset(double offset, double corr_rate);
|
extern int LCL_AccumulateOffset(double offset, double corr_rate);
|
||||||
|
|
||||||
/* Routine to apply an immediate offset by doing a sudden step if
|
/* Routine to apply an immediate offset by doing a sudden step if
|
||||||
possible. (Intended for use after an initial estimate of offset has
|
possible. (Intended for use after an initial estimate of offset has
|
||||||
|
@ -171,7 +171,7 @@ extern void LCL_NotifyLeap(int leap);
|
||||||
|
|
||||||
/* Perform the combination of modifying the frequency and applying
|
/* Perform the combination of modifying the frequency and applying
|
||||||
a slew, in one easy step */
|
a slew, in one easy step */
|
||||||
extern void LCL_AccumulateFrequencyAndOffset(double dfreq, double doffset, double corr_rate);
|
extern int LCL_AccumulateFrequencyAndOffset(double dfreq, double doffset, double corr_rate);
|
||||||
|
|
||||||
/* Routine to read the system precision as a log to base 2 value. */
|
/* Routine to read the system precision as a log to base 2 value. */
|
||||||
extern int LCL_GetSysPrecisionAsLog(void);
|
extern int LCL_GetSysPrecisionAsLog(void);
|
||||||
|
|
Loading…
Reference in a new issue