diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-01 16:23:32 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-01 16:23:38 +0200 |
commit | 372516f77ac66e86663a61604bcdb776bcb6de9d (patch) | |
tree | f466ea4397b32c6bae3fd2a07adb6b06f33c084e /src/json | |
parent | af249ea5cef757a1e2b34cd2754febdb24a34416 (diff) | |
download | gnunet-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.c | 18 |
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 | |||
248 | GNUNET_JSON_pack_time_abs (const char *name, | 248 | GNUNET_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 | ||