@@ -18,6 +18,8 @@ pub struct File(!);
1818pub struct FileAttr {
1919 attr : u64 ,
2020 size : u64 ,
21+ created : r_efi:: efi:: Time ,
22+ times : FileTimes ,
2123}
2224
2325pub struct ReadDir ( !) ;
@@ -33,7 +35,10 @@ pub struct OpenOptions {
3335}
3436
3537#[ derive( Copy , Clone , Debug , Default ) ]
36- pub struct FileTimes { }
38+ pub struct FileTimes {
39+ accessed : r_efi:: efi:: Time ,
40+ modified : r_efi:: efi:: Time ,
41+ }
3742
3843#[ derive( Clone , PartialEq , Eq , Debug ) ]
3944// Bool indicates if file is readonly
@@ -60,15 +65,15 @@ impl FileAttr {
6065 }
6166
6267 pub fn modified ( & self ) -> io:: Result < SystemTime > {
63- unsupported ( )
68+ Ok ( SystemTime :: from_uefi ( self . times . modified ) )
6469 }
6570
6671 pub fn accessed ( & self ) -> io:: Result < SystemTime > {
67- unsupported ( )
72+ Ok ( SystemTime :: from_uefi ( self . times . accessed ) )
6873 }
6974
7075 pub fn created ( & self ) -> io:: Result < SystemTime > {
71- unsupported ( )
76+ Ok ( SystemTime :: from_uefi ( self . created ) )
7277 }
7378}
7479
@@ -92,8 +97,15 @@ impl FilePermissions {
9297}
9398
9499impl FileTimes {
95- pub fn set_accessed ( & mut self , _t : SystemTime ) { }
96- pub fn set_modified ( & mut self , _t : SystemTime ) { }
100+ pub fn set_accessed ( & mut self , t : SystemTime ) {
101+ self . accessed =
102+ t. to_uefi ( self . accessed . timezone , self . accessed . daylight ) . expect ( "Invalid Time" ) ;
103+ }
104+
105+ pub fn set_modified ( & mut self , t : SystemTime ) {
106+ self . modified =
107+ t. to_uefi ( self . modified . timezone , self . modified . daylight ) . expect ( "Invalid Time" ) ;
108+ }
97109}
98110
99111impl FileType {
0 commit comments