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

Function utc_timestring

plugins/pay.c:91–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

paystatus_add_paymentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected