Interface definitions for the "jclmnop:sleepy" capability contract. This contract allows actors to sleep for a specified duration, and also to retrieve the current system time on the wasmcloud host.
Useful for implementing rate limits or other time-based functionality.
```rust use wasmcloudinterfacesleepy::SleepyReceiver; use wasmbus_rpc::Timestamp;
async fn sleepfor5_seconds() { let sleepy = SleepySender::new(); sleepy.sleep(5).await; }
async fn sleepuntil5seconds() { let sleepy = SleepySender::new(); let now = Timestamp::now(); let fiveseconds = Timestamp::new(now.sec + 5, now.nsec); sleepy.sleepuntil(fiveseconds).await; }
async fn getcurrenttime() { let sleepy = SleepySender::new(); let now = sleepy.now().await; println!("Current time: {:?}", now); } ```