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

Function time_multiply

ccan/ccan/time/time.c:68–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68struct timerel time_multiply(struct timerel t, unsigned long mult)
69{
70 struct timerel res;
71
72 /* Are we going to overflow if we multiply nsec? */
73 if (mult & ~((1UL << 30) - 1)) {
74 /* FIXME: fp is cheating! */
75 double nsec = (double)t.ts.tv_nsec * mult;
76
77 res.ts.tv_sec = nsec / 1000000000.0;
78 res.ts.tv_nsec = nsec - (res.ts.tv_sec * 1000000000.0);
79 } else {
80 uint64_t nsec = t.ts.tv_nsec * mult;
81
82 res.ts.tv_nsec = nsec % 1000000000;
83 res.ts.tv_sec = nsec / 1000000000;
84 }
85 res.ts.tv_sec += TIMEREL_CHECK(t).ts.tv_sec * mult;
86 return TIMEREL_CHECK(res);
87}
88
89struct timespec time_check_(struct timespec t, const char *abortstr)
90{

Callers 3

secret_time_testFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by 3

secret_time_testFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68