@@ -18,6 +18,8 @@ pub struct File(!);
18
18
pub struct FileAttr {
19
19
attr : u64 ,
20
20
size : u64 ,
21
+ created : r_efi:: efi:: Time ,
22
+ times : FileTimes ,
21
23
}
22
24
23
25
pub struct ReadDir ( !) ;
@@ -33,7 +35,10 @@ pub struct OpenOptions {
33
35
}
34
36
35
37
#[ 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
+ }
37
42
38
43
#[ derive( Clone , PartialEq , Eq , Debug ) ]
39
44
// Bool indicates if file is readonly
@@ -60,15 +65,15 @@ impl FileAttr {
60
65
}
61
66
62
67
pub fn modified ( & self ) -> io:: Result < SystemTime > {
63
- unsupported ( )
68
+ Ok ( SystemTime :: from_uefi ( self . times . modified ) )
64
69
}
65
70
66
71
pub fn accessed ( & self ) -> io:: Result < SystemTime > {
67
- unsupported ( )
72
+ Ok ( SystemTime :: from_uefi ( self . times . accessed ) )
68
73
}
69
74
70
75
pub fn created ( & self ) -> io:: Result < SystemTime > {
71
- unsupported ( )
76
+ Ok ( SystemTime :: from_uefi ( self . created ) )
72
77
}
73
78
}
74
79
@@ -92,8 +97,15 @@ impl FilePermissions {
92
97
}
93
98
94
99
impl 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
+ }
97
109
}
98
110
99
111
impl FileType {
0 commit comments