| 81 | /* FIXME: Add this to ccan/time? */ |
| 82 | #define UTC_TIMELEN (sizeof("YYYY-mm-ddTHH:MM:SS.nnnZ")) |
| 83 | static void utc_timestring(const struct timeabs *time, char str[UTC_TIMELEN]) |
| 84 | { |
| 85 | char iso8601_msec_fmt[sizeof("YYYY-mm-ddTHH:MM:SS.%03dZ")]; |
| 86 | struct tm *t = gmtime(&time->ts.tv_sec); |
| 87 | |
| 88 | /* Shouldn't happen, but see |
| 89 | * https://github.com/ElementsProject/lightning/issues/4991 :( */ |
| 90 | if (!t) { |
| 91 | snprintf(str, UTC_TIMELEN, "1970-01-01T00:00:00.000Z"); |
| 92 | return; |
| 93 | } |
| 94 | strftime(iso8601_msec_fmt, sizeof(iso8601_msec_fmt), "%FT%T.%%03dZ", t); |
| 95 | snprintf(str, UTC_TIMELEN, iso8601_msec_fmt, |
| 96 | (int) time->ts.tv_nsec / 1000000); |
| 97 | } |
| 98 | |
| 99 | static void json_add_sendpay_result(struct json_stream *s, const struct payment_result *r) |
| 100 | { |
no outgoing calls
no test coverage detected