@@ -151,28 +151,24 @@ impl From<&str> for MetadataTimeField {
151151 }
152152}
153153
154- // The implementations for get_system_time are separated because some options, such
155- // as ctime will not be available
156154#[ cfg( unix) ]
157- pub fn metadata_get_time ( md : & Metadata , md_time : MetadataTimeField ) -> Option < SystemTime > {
158- match md_time {
159- MetadataTimeField :: Change => {
160- // TODO: This is incorrect for negative timestamps.
161- Some ( UNIX_EPOCH + Duration :: new ( md. ctime ( ) as u64 , md. ctime_nsec ( ) as u32 ) )
162- }
163- MetadataTimeField :: Modification => md. modified ( ) . ok ( ) ,
164- MetadataTimeField :: Access => md. accessed ( ) . ok ( ) ,
165- MetadataTimeField :: Birth => md. created ( ) . ok ( ) ,
166- }
155+ fn metadata_get_change_time ( md : & Metadata ) -> Option < SystemTime > {
156+ // TODO: This is incorrect for negative timestamps.
157+ Some ( UNIX_EPOCH + Duration :: new ( md. ctime ( ) as u64 , md. ctime_nsec ( ) as u32 ) )
167158}
168159
169160#[ cfg( not( unix) ) ]
161+ fn metadata_get_change_time ( _md : & Metadata ) -> Option < SystemTime > {
162+ // Not available.
163+ None
164+ }
165+
170166pub fn metadata_get_time ( md : & Metadata , md_time : MetadataTimeField ) -> Option < SystemTime > {
171167 match md_time {
168+ MetadataTimeField :: Change => metadata_get_change_time ( md) ,
172169 MetadataTimeField :: Modification => md. modified ( ) . ok ( ) ,
173170 MetadataTimeField :: Access => md. accessed ( ) . ok ( ) ,
174171 MetadataTimeField :: Birth => md. created ( ) . ok ( ) ,
175- MetadataTimeField :: Change => None ,
176172 }
177173}
178174
0 commit comments