[ntpsec commit] Polish ntptime JSON. It's not done yet.

Eric S. Raymond esr at ntpsec.org
Thu Oct 15 04:32:24 UTC 2015


Module:    ntpsec
Branch:    master
Commit:    194f669d934c0f4eda138815d7aa9456ead47064
Changeset: http://git.ntpsec.org/ntpsec/commit/?id=194f669d934c0f4eda138815d7aa9456ead47064

Author:    Eric S. Raymond <esr at thyrsus.com>
Date:      Thu Oct 15 00:32:04 2015 -0400

Polish ntptime JSON.  It's not done yet.

---

 util/ntptime.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/util/ntptime.c b/util/ntptime.c
index 99b6c7d..d5c4459 100644
--- a/util/ntptime.c
+++ b/util/ntptime.c
@@ -278,12 +278,12 @@ main(
 		const char *ofmt6 = "\n";
 #endif /* NTP_API */
 		/* JSON formats */
-		const char *jfmt1 = "{\"gettime-code\":%d,\"gettime-status\":%s,";
-		const char *jfmt2 = "\"time\":\"%s\",\"fractional time\":\".%0*d\",";
-		const char *jfmt3 = "\"maximum error\":%lu,\"estimated error\":%lu,";
-		const char *jfmt4 = "\"raw ntp time\":\"%x.%x\",\"raw unix time\":\"%x.%0*d %s\",";
+		const char *jfmt1 = "{\"gettime-code\":%d,\"gettime-status\":\"%s\",";
+		const char *jfmt2 = "\"time\":\"%s\",\"fractional-time\":\".%0*d\",";
+		const char *jfmt3 = "\"maximum-error\":%lu,\"estimated-error\":%lu,";
+		const char *jfmt4 = "\"raw-ntp-time\":\"%x.%x\",\"raw-unix-time\":\"%x.%0*d %s\",";
 #if NTP_API > 3
-		const char *jfmt5 = "\"TAI offset\":%d,";
+		const char *jfmt5 = "\"TAI-offset\":%d,";
 #else
 		const char *jfmt6 = "";
 #endif /* NTP_API */
@@ -334,15 +334,15 @@ main(
 		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";
 		/* JSON formats */
-		char *jfmt7 = "\"adjtime-code\":%d,\"adjtime-status\":%s,";
+		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 *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";
+		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";
 
 		flash = ntx.status;
 		printf(json ? jfmt7 : ofmt7, status, timex_state(status));



More information about the vc mailing list