File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ use crate::{
2222} ;
2323
2424/// A measurement of the system clock, useful for talking to external entities
25- /// like the file system or other processes.
25+ /// like the file system or other processes. May be converted losslessly to a
26+ /// more useful `std::time::SystemTime` to provide more methods.
2627#[ derive( Debug , Clone , Copy ) ]
2728#[ allow( dead_code) ]
2829pub struct SystemTime ( wall_clock:: Datetime ) ;
@@ -33,6 +34,14 @@ impl SystemTime {
3334 }
3435}
3536
37+ impl From < SystemTime > for std:: time:: SystemTime {
38+ fn from ( st : SystemTime ) -> Self {
39+ std:: time:: SystemTime :: UNIX_EPOCH
40+ + std:: time:: Duration :: from_secs ( st. 0 . seconds )
41+ + std:: time:: Duration :: from_nanos ( st. 0 . nanoseconds . into ( ) )
42+ }
43+ }
44+
3645/// An async iterator representing notifications at fixed interval.
3746pub fn interval ( duration : Duration ) -> Interval {
3847 Interval { duration }
You can’t perform that action at this time.
0 commit comments