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

Function time_change

common/bolt12.c:303–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303static u64 time_change(u64 prevstart, u32 number,
304 void (*add_time)(struct tm *tm, u32 number),
305 bool day_const)
306{
307 struct tm tm;
308 time_t prev = prevstart, ret;
309
310 tm = *gmtime(&prev);
311
312 for (;;) {
313 struct tm new_tm = tm;
314 add_time(&new_tm, number);
315 ret = mktime(&new_tm);
316
317 if (ret == (time_t)-1)
318 return 0;
319
320 /* If we overflowed that month, try one less. */
321 if (!day_const || new_tm.tm_mday == tm.tm_mday)
322 break;
323 tm.tm_mday--;
324 }
325
326 return ret;
327}
328
329u64 offer_period_start(u64 basetime, size_t n,
330 const struct tlv_offer_recurrence *recur)

Callers 1

offer_period_startFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected