int RTC_Linux_WriteParameters(void) { int retval; if (fd < 0) { return RTC_ST_NODRV; } if (coefs_valid) { retval = write_coefs_to_file(1,coef_ref_time, coef_seconds_fast, coef_gain_rate); } else { /* Don't change the existing file, it may not be 100% valid but is our current best guess. */ retval = RTC_ST_OK; /*write_coefs_to_file(0,0,0.0,0.0); */ } return(retval); }
static void handle_relock_after_trim(void) { int valid; time_t ref; double fast, slope; run_regression(1, &valid, &ref, &fast, &slope); if (valid) { write_coefs_to_file(1,ref,fast,saved_coef_gain_rate); } else { LOG(LOGS_WARN, LOGF_RtcLinux, "Could not do regression after trim"); } coefs_valid = 0; n_samples = 0; n_samples_since_regression = 0; operating_mode = OM_NORMAL; measurement_period = LOWEST_MEASUREMENT_PERIOD; }