| 352 | } |
| 353 | |
| 354 | void json_add_timeiso(struct json_stream *result, |
| 355 | const char *fieldname, |
| 356 | struct timeabs *time) |
| 357 | { |
| 358 | char iso8601_msec_fmt[sizeof("YYYY-mm-ddTHH:MM:SS.%03dZ")]; |
| 359 | char iso8601_s[sizeof("YYYY-mm-ddTHH:MM:SS.nnnZ")]; |
| 360 | |
| 361 | strftime(iso8601_msec_fmt, sizeof(iso8601_msec_fmt), |
| 362 | "%FT%T.%%03dZ", gmtime(&time->ts.tv_sec)); |
| 363 | snprintf(iso8601_s, sizeof(iso8601_s), |
| 364 | iso8601_msec_fmt, (int) time->ts.tv_nsec / 1000000); |
| 365 | |
| 366 | json_add_string(result, fieldname, iso8601_s); |
| 367 | } |
| 368 | |
| 369 | |
| 370 | void json_add_tok(struct json_stream *result, const char *fieldname, |
nothing calls this directly
no test coverage detected