]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sys: remove TMX_ReadCurrentParams
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 9 Dec 2014 16:50:37 +0000 (17:50 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 10 Dec 2014 14:58:27 +0000 (15:58 +0100)
sys_linux.c
wrap_adjtimex.c
wrap_adjtimex.h

index d03eb2f6e0e69d368170cf6f5de311e7af80a4c1..db5532ebe746fc21b683ca7d38e839a4f27d4031 100644 (file)
@@ -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);
     }
   }
 
index a907ff86dc9291915a8d6046c742e8630c2bd2ce..cfc98b8153e56748b7063f2178f61bea523d78d7 100644 (file)
@@ -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)
 {
index 4e2bcf45d6b75f234870a0c45c6fed23bb323713..d1bf94095ff1fee15e1599f49d70e7470d786f51 100644 (file)
 #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);