TODO(benh): Introduce a Clock::time(seconds) that replaces this function for getting a 'Time' value.
| 477 | // TODO(benh): Introduce a Clock::time(seconds) that replaces this |
| 478 | // function for getting a 'Time' value. |
| 479 | Try<Time> Time::create(double seconds) |
| 480 | { |
| 481 | Try<Duration> duration = Duration::create(seconds); |
| 482 | if (duration.isSome()) { |
| 483 | // In production code, clock::advanced will always be zero! |
| 484 | return Time(duration.get() + *clock::advanced); |
| 485 | } else { |
| 486 | return Error("Argument too large for Time: " + duration.error()); |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | } // namespace process { |