Constructs a Timeout instance from a Time that is the 'duration' from now.
| 33 | // Constructs a Timeout instance from a Time that is the 'duration' |
| 34 | // from now. |
| 35 | static Timeout in(const Duration& duration) |
| 36 | { |
| 37 | // We need now() + duration < Duration::max() to avoid overflow. |
| 38 | // Therefore, we check for now() < duration::max() - duration. |
| 39 | if (Clock::now().duration() < Duration::max() - duration) { |
| 40 | return Timeout(Clock::now() + duration); |
| 41 | } |
| 42 | |
| 43 | return Timeout(Time::max()); |
| 44 | } |
| 45 | |
| 46 | Timeout& operator=(const Timeout& that) |
| 47 | { |