diff --git a/src/file.rs b/src/file.rs index af93e074..afa6bf57 100644 --- a/src/file.rs +++ b/src/file.rs @@ -346,9 +346,9 @@ impl<'a> File<'a> { // Need to convert these values from milliseconds into seconds. let time_in_seconds = match time_type { - TimeType::FileAccessed => self.stat.accessed(), - TimeType::FileModified => self.stat.modified(), - TimeType::FileCreated => 0 // self.stat.created(), + TimeType::FileAccessed => self.stat.as_raw().atime(), + TimeType::FileModified => self.stat.as_raw().mtime(), + TimeType::FileCreated => self.stat.as_raw().ctime(), } as i64 / 1000; let date = LocalDateTime::at(time_in_seconds); diff --git a/src/main.rs b/src/main.rs index 49b5bfcd..aa31955d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,5 @@ -#![feature(collections, convert, core, exit_status, file_type, fs_ext, fs_mode, fs_time)] +#![feature(collections, convert, core, exit_status, file_type, fs_ext, fs_mode)] #![feature(libc, metadata_ext, scoped, symlink_metadata)] -#![allow(deprecated)] extern crate ansi_term; extern crate datetime; diff --git a/src/options.rs b/src/options.rs index b2f2d916..5483cdfe 100644 --- a/src/options.rs +++ b/src/options.rs @@ -9,6 +9,7 @@ use term::dimensions; use std::cmp::Ordering; use std::fmt; use std::num::ParseIntError; +use std::os::unix::fs::MetadataExt; use getopts; use natord; @@ -138,14 +139,14 @@ impl FileFilter { SortField::Unsorted => {}, SortField::Name => files.sort_by(|a, b| natord::compare(&*a.name, &*b.name)), SortField::Size => files.sort_by(|a, b| a.stat.len().cmp(&b.stat.len())), - SortField::FileInode => {}, // files.sort_by(|a, b| a.stat.unstable.inode.cmp(&b.stat.unstable.inode)), + SortField::FileInode => files.sort_by(|a, b| a.stat.as_raw().ino().cmp(&b.stat.as_raw().ino())), SortField::Extension => files.sort_by(|a, b| match a.ext.cmp(&b.ext) { Ordering::Equal => natord::compare(&*a.name, &*b.name), order => order }), - SortField::ModifiedDate => files.sort_by(|a, b| a.stat.modified().cmp(&b.stat.modified())), - SortField::AccessedDate => files.sort_by(|a, b| a.stat.accessed().cmp(&b.stat.accessed())), - SortField::CreatedDate => {}, // files.sort_by(|a, b| a.stat.created().cmp(&b.stat.created())), + SortField::ModifiedDate => files.sort_by(|a, b| a.stat.as_raw().mtime().cmp(&b.stat.as_raw().mtime())), + SortField::AccessedDate => files.sort_by(|a, b| a.stat.as_raw().atime().cmp(&b.stat.as_raw().atime())), + SortField::CreatedDate => files.sort_by(|a, b| a.stat.as_raw().ctime().cmp(&b.stat.as_raw().ctime())), } if self.reverse {