| 267 | } |
| 268 | |
| 269 | Duration DurationSegment::timeWarp(Duration maxDuration) const |
| 270 | { |
| 271 | auto const timeWarp = cumTimeWarp_ + timeWarp_; |
| 272 | auto const netDuration = duration() - timeWarp; |
| 273 | |
| 274 | return timeWarp |
| 275 | // Additional time warp from having to wait until release time. |
| 276 | + std::max<Duration>(releaseTime_ - startLate_, 0) |
| 277 | // Max duration constraint applies only to net route duration, |
| 278 | // subtracting existing time warp. Use ternary to avoid underflow. |
| 279 | + (netDuration > maxDuration ? netDuration - maxDuration : 0); |
| 280 | } |
| 281 | |
| 282 | Duration DurationSegment::startEarly() const |
| 283 | { |