async: add sleep_for sender

Sometimes it is useful to do the equivalent of
`std::this_thread::sleep_for` in a co-routine context.  Add a
sender-based implementation to async.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9991eb40b7a1b12e61511f1200bc99fdcdbccf0a
diff --git a/test/async/timer.cpp b/test/async/timer.cpp
new file mode 100644
index 0000000..f377e83
--- /dev/null
+++ b/test/async/timer.cpp
@@ -0,0 +1,24 @@
+#include <sdbusplus/async.hpp>
+
+#include <chrono>
+
+#include <gtest/gtest.h>
+
+using namespace std::literals;
+
+TEST(Timer, DelaySome)
+{
+    static constexpr auto timeout = 500ms;
+
+    sdbusplus::async::context ctx;
+
+    auto start = std::chrono::steady_clock::now();
+
+    ctx.run(sdbusplus::async::sleep_for(ctx, timeout) |
+            std::execution::then([&ctx]() { ctx.request_stop(); }));
+
+    auto stop = std::chrono::steady_clock::now();
+
+    EXPECT_GT(stop - start, timeout);
+    EXPECT_LT(stop - start, timeout * 2);
+}
diff --git a/test/meson.build b/test/meson.build
index c2e937a..0181766 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -22,6 +22,7 @@
 tests = [
     'async/context',
     'async/task',
+    'async/timer',
     'bus/list_names',
     'bus/match',
     'event/event',