Skip to content

Commit

Permalink
Continue using new metadata fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ogham committed May 3, 2015
1 parent 06ef372 commit 8eaa4c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
9 changes: 5 additions & 4 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 8eaa4c5

Please sign in to comment.