We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d1e06b4 + 26b5012 commit 552775bCopy full SHA for 552775b
tests/run-pass/time.rs
@@ -9,10 +9,22 @@ fn main() {
9
for _ in 0..10 { drop(vec![42]); }
10
let now2 = SystemTime::now();
11
assert!(now2 > now1);
12
+ let diff = now2.duration_since(now1).unwrap();
13
+ assert!(diff.as_micros() > 0);
14
+ assert_eq!(now1 + diff, now2);
15
+ assert_eq!(now2 - diff, now1);
16
17
let now1 = Instant::now();
18
// Do some work to make time pass.
19
20
let now2 = Instant::now();
21
22
+
23
+ #[cfg(target_os = "linux")] // TODO: macOS does not support Instant subtraction
24
+ {
25
+ let diff = now2.duration_since(now1);
26
27
28
29
+ }
30
}
0 commit comments