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

Function utc_timestring

plugins/pay.c:83–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81/* FIXME: Add this to ccan/time? */
82#define UTC_TIMELEN (sizeof("YYYY-mm-ddTHH:MM:SS.nnnZ"))
83static 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
99static void json_add_sendpay_result(struct json_stream *s, const struct payment_result *r)
100{

Callers 1

paystatus_add_paymentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected