void SST_Initialise(void) { logfileid = CNF_GetLogStatistics() ? LOG_FileOpen("statistics", " Date (UTC) Time IP Address Std dev'n Est offset Offset sd Diff freq Est skew Stress Ns Bs Nr") : -1; max_samples = CNF_GetMaxSamples(); min_samples = CNF_GetMinSamples(); }
int RTC_Linux_Initialise(void) { rtc_sec = MallocArray(time_t, MAX_SAMPLES); rtc_trim = MallocArray(double, MAX_SAMPLES); system_times = MallocArray(struct timeval, MAX_SAMPLES); /* Setup details depending on configuration options */ setup_config(); /* In case it didn't get done by pre-init */ coefs_file_name = CNF_GetRtcFile(); /* Try to open device */ fd = open (CNF_GetRtcDevice(), O_RDWR); if (fd < 0) { LOG(LOGS_ERR, LOGF_RtcLinux, "Could not open RTC device %s : %s", CNF_GetRtcDevice(), strerror(errno)); return 0; } /* Close on exec */ UTI_FdSetCloexec(fd); n_samples = 0; n_samples_since_regression = 0; n_runs = 0; coefs_valid = 0; measurement_period = LOWEST_MEASUREMENT_PERIOD; operating_mode = OM_NORMAL; /* Register file handler */ SCH_AddInputFileHandler(fd, read_from_device, NULL); /* Register slew handler */ LCL_AddParameterChangeHandler(slew_samples, NULL); logfileid = CNF_GetLogRtc() ? LOG_FileOpen("rtc", " Date (UTC) Time RTC fast (s) Val Est fast (s) Slope (ppm) Ns Nr Meas") : -1; return 1; }