diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2017-09-13 19:04:33 -0700 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2017-09-13 19:17:17 -0700 |
commit | 23f768d1b68ae83d927615057b2c1c9c4d3f88a2 (patch) | |
tree | 207dd186083937250573f38ed734de140b518962 | |
parent | 581398d3ab20c427f37f0b1bd68a8a1d13789bae (diff) |
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 <matt.ranostay@konsulko.com>
-rw-r--r-- | binding/afm-gps-binding.c | 7 |
1 files changed, 7 insertions, 0 deletions
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; |