From 23f768d1b68ae83d927615057b2c1c9c4d3f88a2 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Wed, 13 Sep 2017 19:04:33 -0700 Subject: binding: gps: add timestamp to JSON response Return the timestamp from the gps fix in the JSON data response. Bug-AGL: SPEC-844 Change-Id: I6befdf3f02e523ad40ff73850b41d7a45730c0d8 Signed-off-by: Matt Ranostay --- binding/afm-gps-binding.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/binding/afm-gps-binding.c b/binding/afm-gps-binding.c index ea40331..ffc787b 100644 --- a/binding/afm-gps-binding.c +++ b/binding/afm-gps-binding.c @@ -94,6 +94,13 @@ static json_object *populate_json_data(json_object *jresp) json_object_object_add(jresp, "speed", value); } + if (data.set & TIME_SET) { + char time[30]; + unix_to_iso8601(data.fix.time, (char *) &time, sizeof(time)); + value = json_object_new_string(time); + json_object_object_add(jresp, "timestamp", value); + } + jresp = populate_json_dop_data(jresp, &data.dop); return jresp; -- cgit 1.2.3-korg