| 284 | } |
| 285 | |
| 286 | md_timeperiod_t md_timeperiod_slice_before_end(const md_timeperiod_t *period, |
| 287 | const md_timeslice_t *ts) |
| 288 | { |
| 289 | md_timeperiod_t r; |
| 290 | apr_time_t duration = ts->len; |
| 291 | |
| 292 | if (ts->norm > 0) { |
| 293 | int percent = (int)(((long)apr_time_sec(ts->len)) * 100L |
| 294 | / ((long)apr_time_sec(ts->norm))); |
| 295 | apr_time_t plen = md_timeperiod_length(period); |
| 296 | if (apr_time_sec(plen) > 100) { |
| 297 | duration = apr_time_from_sec(apr_time_sec(plen) * percent / 100); |
| 298 | } |
| 299 | else { |
| 300 | duration = plen * percent / 100; |
| 301 | } |
| 302 | } |
| 303 | r.start = period->end - duration; |
| 304 | r.end = period->end; |
| 305 | return r; |
| 306 | } |
| 307 | |
| 308 | int md_timeslice_eq(const md_timeslice_t *ts1, const md_timeslice_t *ts2) |
| 309 | { |
no test coverage detected