static struct timex ntx;
static u_long ntp_adjtime_time;
- static const double to_ms =
+ static const double to_ms_usec =
+ 1.0e-3; /* usec to msec */
+ static const double to_ms_nusec =
# ifdef STA_NANO
1.0e-6; /* nsec to msec */
# else
- 1.0e-3; /* usec to msec */
+ to_ms_usec;
# endif
/*
case CS_K_OFFSET:
CTL_IF_KERNLOOP(
ctl_putdblf,
- (sys_var[varid].text, 0, -1, to_ms * ntx.offset)
+ (sys_var[varid].text, 0, -1, to_ms_nusec * ntx.offset)
);
break;
CTL_IF_KERNLOOP(
ctl_putdblf,
(sys_var[varid].text, 0, 6,
- to_ms * ntx.maxerror)
+ to_ms_usec * ntx.maxerror)
);
break;
CTL_IF_KERNLOOP(
ctl_putdblf,
(sys_var[varid].text, 0, 6,
- to_ms * ntx.esterror)
+ to_ms_usec * ntx.esterror)
);
break;
CTL_IF_KERNLOOP(
ctl_putdblf,
(sys_var[varid].text, 0, 6,
- to_ms * ntx.precision)
+ to_ms_usec * ntx.precision)
);
break;
case CS_K_PPS_JITTER:
CTL_IF_KERNPPS(
ctl_putdbl,
- (sys_var[varid].text, to_ms * ntx.jitter)
+ (sys_var[varid].text, to_ms_nusec * ntx.jitter)
);
break;
size_t itemsize;
int res;
unsigned status;
- double tscale = 1e-6;
+ double tscale_usec = 1e-6, tscale_unano = 1e-6;
again:
res = doquery(impl_ver, REQ_GET_KERNEL, 0, 0, 0, (char *)NULL,
*/
#ifdef STA_NANO
if (status & STA_NANO)
- tscale = 1e-9;
+ tscale_unano = 1e-9;
#endif
(void)fprintf(fp, "pll offset: %g s\n",
- (int32)ntohl(ik->offset) * tscale);
+ (int32)ntohl(ik->offset) * tscale_unano);
(void)fprintf(fp, "pll frequency: %s ppm\n",
fptoa((s_fp)ntohl(ik->freq), 3));
(void)fprintf(fp, "maximum error: %g s\n",
- (u_long)ntohl(ik->maxerror) * tscale);
+ (u_long)ntohl(ik->maxerror) * tscale_usec);
(void)fprintf(fp, "estimated error: %g s\n",
- (u_long)ntohl(ik->esterror) * tscale);
+ (u_long)ntohl(ik->esterror) * tscale_usec);
(void)fprintf(fp, "status: %04x ", status);
#ifdef STA_PLL
if (status & STA_PLL) (void)fprintf(fp, " pll");
(void)fprintf(fp, "pll time constant: %ld\n",
(u_long)ntohl(ik->constant));
(void)fprintf(fp, "precision: %g s\n",
- (u_long)ntohl(ik->precision) * tscale);
+ (u_long)ntohl(ik->precision) * tscale_usec);
(void)fprintf(fp, "frequency tolerance: %s ppm\n",
fptoa((s_fp)ntohl(ik->tolerance), 0));
(void)fprintf(fp, "pps stability: %s ppm\n",
fptoa((s_fp)ntohl(ik->stabil), 3));
(void)fprintf(fp, "pps jitter: %g s\n",
- (u_long)ntohl(ik->jitter) * tscale);
+ (u_long)ntohl(ik->jitter) * tscale_unano);
(void)fprintf(fp, "calibration interval: %d s\n",
1 << ntohs(ik->shift));
(void)fprintf(fp, "calibration cycles: %ld\n",
printf(" status %s,\n", sprintb((u_int)ntx.status, TIMEX_STA_BITS));
ftemp = (double)ntx.tolerance / SCALE_FREQ;
gtemp = (double)ntx.precision;
-#ifdef STA_NANO
- if (flash & STA_NANO)
- gtemp /= 1000.0;
-#endif
printf(
" time constant %lu, precision %.3f us, tolerance %.0f ppm,\n",
(u_long)ntx.constant, gtemp, ftemp);