From eadabfe890e10d0cb47f342d61b0e3e73bce0124 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 9 Dec 2014 17:50:37 +0100 Subject: [PATCH] sys: remove TMX_ReadCurrentParams --- sys_linux.c | 11 ++++++----- wrap_adjtimex.c | 45 --------------------------------------------- wrap_adjtimex.h | 38 -------------------------------------- 3 files changed, 6 insertions(+), 88 deletions(-) diff --git a/sys_linux.c b/sys_linux.c index d03eb2f..db5532e 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -288,17 +288,18 @@ get_version_specific_details(void) { int major, minor, patch; int shift_hz; - struct tmx_params tmx_params; + long tick; + double freq; struct utsname uts; if (!get_hz_and_shift_hz(&hz, &shift_hz)) { - TMX_ReadCurrentParams(&tmx_params); + if (TMX_GetFrequency(&freq, &tick) < 0) + LOG_FATAL(LOGF_SysLinux, "adjtimex() failed"); - guess_hz_and_shift_hz(tmx_params.tick, &hz, &shift_hz); + guess_hz_and_shift_hz(tick, &hz, &shift_hz); if (!shift_hz) { - LOG_FATAL(LOGF_SysLinux, "Can't determine hz (txc.tick=%ld txc.freq=%ld (%.8f) txc.offset=%ld)", - tmx_params.tick, tmx_params.freq, tmx_params.dfreq, tmx_params.offset); + LOG_FATAL(LOGF_SysLinux, "Can't determine hz from tick %ld", tick); } } diff --git a/wrap_adjtimex.c b/wrap_adjtimex.c index a907ff8..cfc98b8 100644 --- a/wrap_adjtimex.c +++ b/wrap_adjtimex.c @@ -89,51 +89,6 @@ TMX_GetFrequency(double *freq, long *tick) return result; } -int -TMX_ReadCurrentParams(struct tmx_params *params) -{ - struct timex txc; - int result; - - txc.modes = 0; /* pure read */ - result = adjtimex(&txc); - - params->tick = txc.tick; - params->offset = txc.offset; - params->freq = txc.freq; - params->dfreq = txc.freq / (double)(1 << SHIFT_USEC); - params->maxerror = txc.maxerror; - params->esterror = txc.esterror; - - params->sta_pll = !!(txc.status & STA_PLL); - params->sta_ppsfreq = !!(txc.status & STA_PPSFREQ); - params->sta_ppstime = !!(txc.status & STA_PPSTIME); - params->sta_fll = !!(txc.status & STA_FLL); - params->sta_ins = !!(txc.status & STA_INS); - params->sta_del = !!(txc.status & STA_DEL); - params->sta_unsync = !!(txc.status & STA_UNSYNC); - params->sta_freqhold = !!(txc.status & STA_FREQHOLD); - params->sta_ppssignal = !!(txc.status & STA_PPSSIGNAL); - params->sta_ppsjitter = !!(txc.status & STA_PPSJITTER); - params->sta_ppswander = !!(txc.status & STA_PPSWANDER); - params->sta_ppserror = !!(txc.status & STA_PPSERROR); - params->sta_clockerr = !!(txc.status & STA_CLOCKERR); - - params->constant = txc.constant; - params->precision = txc.precision; - params->tolerance = txc.tolerance; - params->ppsfreq = txc.ppsfreq; - params->jitter = txc.jitter; - params->shift = txc.shift; - params->stabil = txc.stabil; - params->jitcnt = txc.jitcnt; - params->calcnt = txc.calcnt; - params->errcnt = txc.errcnt; - params->stbcnt = txc.stbcnt; - - return result; -} - int TMX_SetLeap(int leap) { diff --git a/wrap_adjtimex.h b/wrap_adjtimex.h index 4e2bcf4..d1bf940 100644 --- a/wrap_adjtimex.h +++ b/wrap_adjtimex.h @@ -27,47 +27,9 @@ #ifndef GOT_WRAP_ADJTIMEX_H #define GOT_WRAP_ADJTIMEX_H -/* Cut-down version of struct timex */ -struct tmx_params { - long tick; - long offset; - long freq; - double dfreq; - long maxerror; - long esterror; - - unsigned sta_pll:1; - unsigned sta_ppsfreq:1; - unsigned sta_ppstime:1; - unsigned sta_fll:1; - unsigned sta_ins:1; - unsigned sta_del:1; - unsigned sta_unsync:1; - unsigned sta_freqhold:1; - unsigned sta_ppssignal:1; - unsigned sta_ppsjitter:1; - unsigned sta_ppswander:1; - unsigned sta_ppserror:1; - unsigned sta_clockerr:1; - - int status; - long constant; - long precision; - long tolerance; - long ppsfreq; - long jitter; - int shift; - long stabil; - long jitcnt; - long calcnt; - long errcnt; - long stbcnt; -}; - int TMX_ResetOffset(void); int TMX_SetFrequency(double *freq, long tick); int TMX_GetFrequency(double *freq, long *tick); -int TMX_ReadCurrentParams(struct tmx_params *params); int TMX_SetLeap(int leap); int TMX_SetSync(int sync, double est_error, double max_error); int TMX_TestStepOffset(void);