| 301 | } |
| 302 | |
| 303 | static 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 | |
| 329 | u64 offer_period_start(u64 basetime, size_t n, |
| 330 | const struct tlv_offer_recurrence *recur) |
no outgoing calls
no test coverage detected