wasmcloud-interface-timing

Crates.iowasmcloud-interface-timing
lib.rswasmcloud-interface-timing
version0.1.2
sourcesrc
created_at2023-04-18 16:39:54.755769
updated_at2023-05-02 16:45:50.023905
descriptionInterface for actors to perform time related operations
homepage
repositoryhttps://github.com/wasmcloud/examples
max_upload_size
id842622
size7,695
(jclmnop)

documentation

README

wasmcloud-interface-timing

crates.io Documentation

Interface definition for the "wasmcloud:timing" capability contract. This contract allows actors to retrieve the current system time on the wasmcloud host.

The Timestamp struct has nanosecond precision, so if it will be exposed to users at any point, care should be taken to avoid timing attacks by truncating the nsec field or to setting it to 0.

The default implementation of this capability contract truncates the Timestamp to millisecond precision, but it may be necessary to reduce the precision even further.

Example

use wasmcloud_interface_timing::TimingSender;
use wasmbus_rpc::actor::prelude::*;
use wasmbus_rpc::Timestamp;

async fn get_current_time(ctx: &Context) -> RpcResult<Timestamp> {
    let timing = TimingSender::new();
    timing.now(ctx).await
}
Commit count: 372

cargo fmt