From: Miroslav Lichvar Date: Thu, 4 Mar 2021 08:59:25 +0000 (+0100) Subject: local: return status from offset accumulation X-Git-Tag: 4.1-pre1~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e86b60a9d7e7dde95a85e7839aad43bdfa40c973;p=thirdparty%2Fchrony.git local: return status from offset accumulation Change the functions accumulating offset to return success or failure. --- diff --git a/local.c b/local.c index df4cee7b..8dbee183 100644 --- a/local.c +++ b/local.c @@ -505,7 +505,7 @@ LCL_AccumulateDeltaFrequency(double dfreq) /* ================================================== */ -void +int LCL_AccumulateOffset(double offset, double corr_rate) { struct timespec raw, cooked; @@ -517,12 +517,14 @@ LCL_AccumulateOffset(double offset, double corr_rate) LCL_CookTime(&raw, &cooked, NULL); if (!check_offset(&cooked, offset)) - return; + return 0; (*drv_accrue_offset)(offset, corr_rate); /* Dispatch to all handlers */ 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) { struct timespec raw, cooked; @@ -598,7 +600,7 @@ LCL_AccumulateFrequencyAndOffset(double dfreq, double doffset, double corr_rate) LCL_CookTime(&raw, &cooked, NULL); if (!check_offset(&cooked, doffset)) - return; + return 0; old_freq_ppm = current_freq_ppm; @@ -620,6 +622,8 @@ LCL_AccumulateFrequencyAndOffset(double dfreq, double doffset, double corr_rate) /* Dispatch to all handlers */ invoke_parameter_change_handlers(&raw, &cooked, dfreq, doffset, LCL_ChangeAdjust); + + return 1; } /* ================================================== */ diff --git a/local.h b/local.h index 1a6fb970..63d80e9e 100644 --- a/local.h +++ b/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 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 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 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. */ extern int LCL_GetSysPrecisionAsLog(void);