Sha256: 23e997ade3517b32fa3a33a783f7b0dc6ef9a86090079ff2dc9dbcb93415fecb
Contents?: true
Size: 653 Bytes
Versions: 8
Compression:
Stored size: 653 Bytes
Contents
use async_timer::Interval; use tokio_1 as tokio; use std::time; #[tokio::test] async fn test_interval() { let mut interval = Interval::platform_new(time::Duration::from_secs(1)); let before = time::SystemTime::now(); interval.wait().await; let after = time::SystemTime::now(); let diff = after.duration_since(before).unwrap(); assert!(diff.as_millis() >= 750 && diff.as_millis() <= 1_250); let before = time::SystemTime::now(); interval.wait().await; let after = time::SystemTime::now(); let diff = after.duration_since(before).unwrap(); assert!(diff.as_millis() >= 750 && diff.as_millis() <= 1_250); }
Version data entries
8 entries across 8 versions & 1 rubygems