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

Function time_change

common/bolt12.c:449–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449static u64 time_change(u64 prevstart, u32 number,
450 void (*add_time)(struct tm *tm, u32 number),
451 bool day_const)
452{
453 struct tm tm;
454 time_t prev = prevstart, ret;
455
456 tm = *gmtime(&prev);
457
458 for (;;) {
459 struct tm new_tm = tm;
460 add_time(&new_tm, number);
461 ret = mktime(&new_tm);
462
463 if (ret == (time_t)-1)
464 return 0;
465
466 /* If we overflowed that month, try one less. */
467 if (!day_const || new_tm.tm_mday == tm.tm_mday)
468 break;
469 tm.tm_mday--;
470 }
471
472 return ret;
473}
474
475u64 offer_period_start(u64 basetime, size_t n,
476 const struct recurrence *recur)

Callers 1

offer_period_startFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected