mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
### Motivation Code that tries to work with `NIODeadline` can be challenging to test using `EmbeddedEventLoop` and `NIOAsyncTestingEventLoop` because they have their own, fake clock. These testing event loops do implement `scheduleTask(in:_)` to submit work in the future, relative to the event loop clock, but there is no way to get the event loop's current notion of "now", as a `NIODeadline`, and users sometimes find that `NIODeadline.now`, which returns the time of the real clock, to be surprising. ### Modifications Add `EventLoop.now` to get the current time of the event loop clock. ### Result New APIs to support writing code that's easier to test.