aboutsummaryrefslogtreecommitdiff
path: root/src/json/json_pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/json/json_pack.c')
-rw-r--r--src/json/json_pack.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/json/json_pack.c b/src/json/json_pack.c
index c61d3331f..92f8b4535 100644
--- a/src/json/json_pack.c
+++ b/src/json/json_pack.c
@@ -248,12 +248,20 @@ struct GNUNET_JSON_PackSpec
248GNUNET_JSON_pack_time_abs (const char *name, 248GNUNET_JSON_pack_time_abs (const char *name,
249 struct GNUNET_TIME_Absolute at) 249 struct GNUNET_TIME_Absolute at)
250{ 250{
251 json_t *json; 251 struct GNUNET_JSON_PackSpec ps = {
252 .field_name = name
253 };
252 254
253 json = GNUNET_JSON_from_time_abs (at); 255 if (0 != at.abs_value_us)
254 GNUNET_assert (NULL != json); 256 {
255 return GNUNET_JSON_pack_object_steal (name, 257 ps.object = GNUNET_JSON_from_time_abs (at);
256 json); 258 GNUNET_assert (NULL != ps.object);
259 }
260 else
261 {
262 ps.object = NULL;
263 }
264 return ps;
257} 265}
258 266
259 267