aboutsummaryrefslogtreecommitdiff
path: root/src/json
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-01 16:23:32 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-01 16:23:38 +0200
commit372516f77ac66e86663a61604bcdb776bcb6de9d (patch)
treef466ea4397b32c6bae3fd2a07adb6b06f33c084e /src/json
parentaf249ea5cef757a1e2b34cd2754febdb24a34416 (diff)
downloadgnunet-372516f77ac66e86663a61604bcdb776bcb6de9d.tar.gz
gnunet-372516f77ac66e86663a61604bcdb776bcb6de9d.zip
0 for absolute time is special, and should be treated as such in JSON generation
Diffstat (limited to 'src/json')
-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