common: add json_add_timerel helper.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -372,6 +372,14 @@ void json_add_timeabs(struct json_stream *result, const char *fieldname,
|
||||
(u64)t.ts.tv_sec, (u64)t.ts.tv_nsec);
|
||||
}
|
||||
|
||||
void json_add_timerel(struct json_stream *result, const char *fieldname,
|
||||
struct timerel t)
|
||||
{
|
||||
json_add_primitive_fmt(result, fieldname,
|
||||
"%" PRIu64 ".%09" PRIu64,
|
||||
(u64)t.ts.tv_sec, (u64)t.ts.tv_nsec);
|
||||
}
|
||||
|
||||
void json_add_timestr(struct json_stream *result, const char *fieldname,
|
||||
struct timespec ts)
|
||||
{
|
||||
|
||||
@@ -253,9 +253,14 @@ void json_add_hex_talarr(struct json_stream *result,
|
||||
const char *fieldname,
|
||||
const tal_t *data);
|
||||
|
||||
/* '"fieldname" : 1749785122.000000001 */
|
||||
void json_add_timeabs(struct json_stream *result, const char *fieldname,
|
||||
struct timeabs t);
|
||||
|
||||
/* '"fieldname" : 1.000000001 */
|
||||
void json_add_timerel(struct json_stream *result, const char *fieldname,
|
||||
struct timerel t);
|
||||
|
||||
/* used in log.c and notification.c*/
|
||||
void json_add_timestr(struct json_stream *result, const char *fieldname,
|
||||
struct timespec ts);
|
||||
|
||||
Reference in New Issue
Block a user