From d1da0f2f224e2be951c2c9ee3173d16284095b6d Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 17 Apr 2019 18:18:40 +0200 Subject: [PATCH] json: fix packing of timestamp values --- lib/formats/json.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/formats/json.cpp b/lib/formats/json.cpp index df09b2dd1..ca461a891 100644 --- a/lib/formats/json.cpp +++ b/lib/formats/json.cpp @@ -54,14 +54,20 @@ static json_t * json_pack_timestamps(struct io *io, struct sample *smp) { json_t *json_ts = json_object(); +#ifdef __arm__ // TODO: check + const char *fmt = "[ i, i ]"; +#else + const char *fmt = "[ I, I ]"; +#endif + if (io->flags & SAMPLE_HAS_TS_ORIGIN) { if (smp->flags & SAMPLE_HAS_TS_ORIGIN) - json_object_set(json_ts, "origin", json_pack("[ I, I ]", smp->ts.origin.tv_sec, smp->ts.origin.tv_nsec)); + json_object_set(json_ts, "origin", json_pack(fmt, smp->ts.origin.tv_sec, smp->ts.origin.tv_nsec)); } if (io->flags & SAMPLE_HAS_TS_RECEIVED) { if (smp->flags & SAMPLE_HAS_TS_RECEIVED) - json_object_set(json_ts, "received", json_pack("[ I, I ]", smp->ts.received.tv_sec, smp->ts.received.tv_nsec)); + json_object_set(json_ts, "received", json_pack(fmt, smp->ts.received.tv_sec, smp->ts.received.tv_nsec)); } return json_ts;