Skip to content
Commits on Source (4)
......@@ -134,17 +134,17 @@ static void mx4200_shutdown (int, struct peer *);
static void mx4200_receive (struct recvbuf *);
static void mx4200_poll (int, struct peer *);
static char * mx4200_parse_t (struct peer *);
static char * mx4200_parse_p (struct peer *);
static char * mx4200_parse_s (struct peer *);
static const char * mx4200_parse_t (struct peer *);
static const char * mx4200_parse_p (struct peer *);
static const char * mx4200_parse_s (struct peer *);
int mx4200_cmpl_fp (const void *, const void *);
static bool mx4200_config (struct peer *);
static void mx4200_ref (struct peer *);
static void mx4200_send (struct peer *, char *, ...)
static void mx4200_send (struct peer *, const char *, ...)
__attribute__ ((format (printf, 2, 3)));
static uint8_t mx4200_cksum (char *, int);
static int mx4200_jday (int, int, int);
static void mx4200_debug (struct peer *, char *, ...)
static void mx4200_debug (struct peer *, const char *, ...)
__attribute__ ((format (printf, 2, 3)));
static bool mx4200_pps (struct peer *);
......@@ -645,6 +645,7 @@ mx4200_receive(
struct refclockproc *pp;
struct peer *peer;
char *cp;
const char *ccp;
int sentence_type;
uint8_t ck;
......@@ -756,9 +757,9 @@ mx4200_receive(
* indicates the receiver needs to be initialized; thus, it is
* not necessary to decode the status message.
*/
if ((cp = mx4200_parse_s(peer)) != NULL) {
if ((ccp = mx4200_parse_s(peer)) != NULL) {
mx4200_debug(peer,
"mx4200_receive: status: %s\n", cp);
"mx4200_receive: status: %s\n", ccp);
}
mx4200_debug(peer, "mx4200_receive: reset receiver\n");
mx4200_config(peer);
......@@ -773,8 +774,9 @@ mx4200_receive(
/*
* Parse the message, calculating our averaged position.
*/
if ((cp = mx4200_parse_p(peer)) != NULL) {
mx4200_debug(peer, "mx4200_receive: pos: %s\n", cp);
if ((ccp = mx4200_parse_p(peer)) != NULL) {
mx4200_debug(peer, "mx4200_receive: pos: %s\n",
ccp);
return;
}
mx4200_debug(peer,
......@@ -802,9 +804,9 @@ mx4200_receive(
case PMVXG_D_SOFTCONF:
case PMVXG_D_TRECOVUSEAGE:
if ((cp = mx4200_parse_s(peer)) != NULL) {
if ((ccp = mx4200_parse_s(peer)) != NULL) {
mx4200_debug(peer,
"mx4200_receive: multi-record: %s\n", cp);
"mx4200_receive: multi-record: %s\n", ccp);
}
break;
......@@ -828,8 +830,8 @@ mx4200_receive(
* Parse the time recovery message, and keep the info
* to print the pretty billboards.
*/
if ((cp = mx4200_parse_t(peer)) != NULL) {
mx4200_debug(peer, "mx4200_receive: time: %s\n", cp);
if ((ccp = mx4200_parse_t(peer)) != NULL) {
mx4200_debug(peer, "mx4200_receive: time: %s\n", ccp);
refclock_report(peer, CEVNT_BADREPLY);
return;
}
......@@ -923,7 +925,7 @@ mx4200_receive(
* further ahead of UTC time.
*
*/
static char *
static const char *
mx4200_parse_t(
struct peer *peer
)
......@@ -1206,7 +1208,7 @@ mx4200_jday(
* 57 = 3 sat startup failed
* 58 = Command abort
*/
static char *
static const char *
mx4200_parse_p(
struct peer *peer
)
......@@ -1428,7 +1430,7 @@ mx4200_parse_p(
* 8 Position Known PRN (absent on MX 4200)
*
*/
static char *
static const char *
mx4200_parse_s(
struct peer *peer
)
......@@ -1532,7 +1534,7 @@ mx4200_pps(
* mx4200_debug - print debug messages
*/
static void
mx4200_debug(struct peer *peer, char *fmt, ...)
mx4200_debug(struct peer *peer, const char *fmt, ...)
{
UNUSED_ARG(peer);
#ifndef DEBUG
......@@ -1558,7 +1560,7 @@ mx4200_debug(struct peer *peer, char *fmt, ...)
* Send a character string to the receiver. Checksum is appended here.
*/
static void
mx4200_send(struct peer *peer, char *fmt, ...)
mx4200_send(struct peer *peer, const char *fmt, ...)
{
struct refclockproc *pp;
......
......@@ -342,25 +342,25 @@ main(
} else {
char binbuf[132];
/* oldstyle formats */
char *ofmt7 = "ntp_adjtime() returns code %d (%s)\n";
char *ofmt8 = " modes %s,\n";
char *ofmt9 = " offset %.3f";
char *ofmt10 = " us, frequency %.3f ppm, interval %d s,\n";
char *ofmt11 = " maximum error %lu us, estimated error %lu us,\n";
char *ofmt12 = " status %s,\n";
char *ofmt13 = " time constant %lu, precision %.3f us, tolerance %.0f ppm,\n";
char *ofmt14 = " pps frequency %.3f ppm, stability %.3f ppm, jitter %.3f us,\n";
char *ofmt15 = " intervals %lu, jitter exceeded %lu, stability exceeded %lu, errors %lu.\n";
const char *ofmt7 = "ntp_adjtime() returns code %d (%s)\n";
const char *ofmt8 = " modes %s,\n";
const char *ofmt9 = " offset %.3f";
const char *ofmt10 = " us, frequency %.3f ppm, interval %d s,\n";
const char *ofmt11 = " maximum error %lu us, estimated error %lu us,\n";
const char *ofmt12 = " status %s,\n";
const char *ofmt13 = " time constant %lu, precision %.3f us, tolerance %.0f ppm,\n";
const char *ofmt14 = " pps frequency %.3f ppm, stability %.3f ppm, jitter %.3f us,\n";
const char *ofmt15 = " intervals %lu, jitter exceeded %lu, stability exceeded %lu, errors %lu.\n";
/* JSON formats */
char *jfmt7 = "\"adjtime-code\":%d,\"adjtime-status\":\"%s\",";
char *jfmt8 = "\"modes\":\"%s\",";
char *jfmt9 = "\"offset\":%.3f,";
char *jfmt10 = "\"frequency\":%.3f,\"interval\":%d,";
char *jfmt11 = "\"maximum-error\":%lu,\"estimated-error\":%lu,";
char *jfmt12 = "\"status\":\"%s\",";
char *jfmt13 = "\"time-constant\":%lu,\"precision\":%.3f,\"tolerance\":%.0f,";
char *jfmt14 = "\"pps-frequency\":%.3f,\"stability\":%.3f,\"jitter\":%.3f,";
char *jfmt15 = "\"intervals\":%lu,\"jitter-exceeded\":%lu,\"stability-exceeded\":%lu,\"errors:%lu\n";
const char *jfmt7 = "\"adjtime-code\":%d,\"adjtime-status\":\"%s\",";
const char *jfmt8 = "\"modes\":\"%s\",";
const char *jfmt9 = "\"offset\":%.3f,";
const char *jfmt10 = "\"frequency\":%.3f,\"interval\":%d,";
const char *jfmt11 = "\"maximum-error\":%lu,\"estimated-error\":%lu,";
const char *jfmt12 = "\"status\":\"%s\",";
const char *jfmt13 = "\"time-constant\":%lu,\"precision\":%.3f,\"tolerance\":%.0f,";
const char *jfmt14 = "\"pps-frequency\":%.3f,\"stability\":%.3f,\"jitter\":%.3f,";
const char *jfmt15 = "\"intervals\":%lu,\"jitter-exceeded\":%lu,\"stability-exceeded\":%lu,\"errors:%lu\n";
flash = ntx.status;
printf(json ? jfmt7 : ofmt7, status, timex_state(status));
......
......@@ -258,15 +258,15 @@ TEST(lfpfunc, FDF_RoundTrip) {
double op2, d;
l_fp op1 = lfpinit_u(addsub_tab[idx][0].l_ui,
addsub_tab[idx][0].l_uf);
// op2 = lfptod(op1);
op2 = ldexp((double)((int64_t)op1), -32);
op2 = lfptod(op1);
l_fp op3 = dtolfp(op2);
l_fp temp = op1 - op3;
d = lfptod(temp);
/* cast to long unsgiend int for 32 bit binaries */
snprintf(msg, sizeof(msg), "op2: %f diff %f not within %e",
op2, d, eps(op2));
snprintf(msg, sizeof(msg),
"\nop2: %f op3: %s diff %f not within %e",
op2, mfptoa(op3, 8), d, eps(op2));
TEST_ASSERT_DOUBLE_WITHIN_MESSAGE(eps(op2), 0.0, fabs(d), msg);
}
......