Continue using new metadata fields

This commit is contained in:
Ben S 2015-05-03 16:25:53 +01:00
parent 06ef372560
commit 8eaa4c550c
3 changed files with 9 additions and 9 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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 {