MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_add_timeiso

Function json_add_timeiso

common/json_stream.c:377–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375}
376
377void json_add_timeiso(struct json_stream *result,
378 const char *fieldname,
379 struct timeabs time)
380{
381 char iso8601_msec_fmt[sizeof("YYYY-mm-ddTHH:MM:SS.%03dZ")];
382 char iso8601_s[sizeof("YYYY-mm-ddTHH:MM:SS.nnnZ")];
383
384 strftime(iso8601_msec_fmt, sizeof(iso8601_msec_fmt),
385 "%FT%T.%%03dZ", gmtime(&time.ts.tv_sec));
386 snprintf(iso8601_s, sizeof(iso8601_s),
387 iso8601_msec_fmt, (int) time.ts.tv_nsec / 1000000);
388
389 json_add_string(result, fieldname, iso8601_s);
390}
391
392
393void json_add_tok(struct json_stream *result, const char *fieldname,

Calls 1

json_add_stringFunction · 0.70

Tested by

no test coverage detected