| 138 | } |
| 139 | |
| 140 | static struct command_result *param_recurrence(struct command *cmd, |
| 141 | const char *name, |
| 142 | const char *buffer, |
| 143 | const jsmntok_t *tok, |
| 144 | struct recurrence **recurrence) |
| 145 | { |
| 146 | u32 mul, period; |
| 147 | const struct time_string *ts; |
| 148 | |
| 149 | ts = json_to_time(buffer, tok, &mul); |
| 150 | if (!ts) |
| 151 | return command_fail_badparam(cmd, name, buffer, tok, |
| 152 | "not a valid time"); |
| 153 | |
| 154 | if (!assign_overflow_u32(&period, ts->mul * (u64)mul)) |
| 155 | return command_fail_badparam( |
| 156 | cmd, name, buffer, tok, |
| 157 | "period is too large to fit in 32 bits"); |
| 158 | |
| 159 | *recurrence = tal(cmd, struct recurrence); |
| 160 | (*recurrence)->time_unit = ts->unit; |
| 161 | (*recurrence)->period = period; |
| 162 | return NULL; |
| 163 | } |
| 164 | |
| 165 | static struct command_result *param_recurrence_base(struct command *cmd, |
| 166 | const char *name, |
nothing calls this directly
no test coverage detected