diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2021-12-15 13:18:24 +0100 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2021-12-15 17:01:58 +0100 |
commit | 8faf7660d98bfd6177d89c5b74c5391e6f606284 (patch) | |
tree | 5aae12a439c5140d60b68063bbdbf21a6d7ccec0 | |
parent | f27fe484c60be69e762e038a84331a3a72111957 (diff) | |
download | gnunet-8faf7660d98bfd6177d89c5b74c5391e6f606284.tar.gz gnunet-8faf7660d98bfd6177d89c5b74c5391e6f606284.zip |
enable v10 backwards compatibility
-rw-r--r-- | src/json/json_generator.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/json/json_generator.c b/src/json/json_generator.c index eb275712c..5421b9527 100644 --- a/src/json/json_generator.c +++ b/src/json/json_generator.c | |||
@@ -71,6 +71,15 @@ GNUNET_JSON_from_timestamp (struct GNUNET_TIME_Timestamp stamp) | |||
71 | json_decref (j); | 71 | json_decref (j); |
72 | return NULL; | 72 | return NULL; |
73 | } | 73 | } |
74 | if (0 != | ||
75 | json_object_set_new (j, | ||
76 | "t_ms", | ||
77 | json_string ("never"))) | ||
78 | { | ||
79 | GNUNET_break (0); | ||
80 | json_decref (j); | ||
81 | return NULL; | ||
82 | } | ||
74 | return j; | 83 | return j; |
75 | } | 84 | } |
76 | GNUNET_assert ( | 85 | GNUNET_assert ( |
@@ -89,6 +98,18 @@ GNUNET_JSON_from_timestamp (struct GNUNET_TIME_Timestamp stamp) | |||
89 | json_decref (j); | 98 | json_decref (j); |
90 | return NULL; | 99 | return NULL; |
91 | } | 100 | } |
101 | if (0 != | ||
102 | json_object_set_new ( | ||
103 | j, | ||
104 | "t_ms", | ||
105 | json_integer ( | ||
106 | (json_int_t) (stamp.abs_time.abs_value_us | ||
107 | / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us)))) | ||
108 | { | ||
109 | GNUNET_break (0); | ||
110 | json_decref (j); | ||
111 | return NULL; | ||
112 | } | ||
92 | return j; | 113 | return j; |
93 | } | 114 | } |
94 | 115 | ||
@@ -122,6 +143,15 @@ GNUNET_JSON_from_time_rel (struct GNUNET_TIME_Relative stamp) | |||
122 | json_decref (j); | 143 | json_decref (j); |
123 | return NULL; | 144 | return NULL; |
124 | } | 145 | } |
146 | if (0 != | ||
147 | json_object_set_new (j, | ||
148 | "d_ms", | ||
149 | json_string ("forever"))) | ||
150 | { | ||
151 | GNUNET_break (0); | ||
152 | json_decref (j); | ||
153 | return NULL; | ||
154 | } | ||
125 | return j; | 155 | return j; |
126 | } | 156 | } |
127 | if (stamp.rel_value_us >= (1LLU << 53)) | 157 | if (stamp.rel_value_us >= (1LLU << 53)) |
@@ -140,6 +170,16 @@ GNUNET_JSON_from_time_rel (struct GNUNET_TIME_Relative stamp) | |||
140 | json_decref (j); | 170 | json_decref (j); |
141 | return NULL; | 171 | return NULL; |
142 | } | 172 | } |
173 | if (0 != | ||
174 | json_object_set_new ( | ||
175 | j, | ||
176 | "d_ms", | ||
177 | json_integer (((json_int_t) stamp.rel_value_us)/1000LL))) | ||
178 | { | ||
179 | GNUNET_break (0); | ||
180 | json_decref (j); | ||
181 | return NULL; | ||
182 | } | ||
143 | return j; | 183 | return j; |
144 | } | 184 | } |
145 | 185 | ||