diff --git a/Vagrantfile b/Vagrantfile index 10c2e79d8f0adba3e091277a6856f526d6d9e25d..999ed95f17726b01cee00eceec4c773060985b0d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -320,6 +320,8 @@ Vagrant.configure(2) do |config| touch -t #{old} -a "#{test_dir}/dates/plum" touch -t #{med} -a "#{test_dir}/dates/pear" touch -t #{new} -a "#{test_dir}/dates/peach" + + sudo chown #{user}:#{user} -R "#{test_dir}/dates" EOF diff --git a/src/fs/file.rs b/src/fs/file.rs index 3defdd78758732f0435fa5cb7bda616c3abd75fa..6e99ca7d13b2571d257f3d89d03769de82672586 100644 --- a/src/fs/file.rs +++ b/src/fs/file.rs @@ -282,7 +282,7 @@ impl<'dir> File<'dir> { } pub fn accessed_time(&self) -> f::Time { - f::Time(self.metadata.mtime()) + f::Time(self.metadata.atime()) } /// This file's 'type'. diff --git a/xtests/dates_accessed b/xtests/dates_accessed new file mode 100644 index 0000000000000000000000000000000000000000..3d80658abdef446b915123933d224fc0e8bfe4a9 --- /dev/null +++ b/xtests/dates_accessed @@ -0,0 +1,4 @@ +Permissions Size User Date Accessed Name +.rw-rw-r-- 0 cassowary  3 Mar 2003 plum +.rw-rw-r-- 0 cassowary 15 Jun 2006 pear +.rw-rw-r-- 0 cassowary 22 Jul 2009 peach diff --git a/xtests/dates_modified b/xtests/dates_modified new file mode 100644 index 0000000000000000000000000000000000000000..166b68fa78c174fe6f4c4497d06de36e1bfdb2c8 --- /dev/null +++ b/xtests/dates_modified @@ -0,0 +1,4 @@ +Permissions Size User Date Modified Name +.rw-rw-r-- 0 cassowary  3 Mar 2003 pear +.rw-rw-r-- 0 cassowary 15 Jun 2006 peach +.rw-rw-r-- 0 cassowary 22 Jul 2009 plum diff --git a/xtests/run.sh b/xtests/run.sh index 8493f971922c3128f89beef8d0c5bd3d904c3885..42200e05761e15bef952964b046790ccd2e9a41b 100755 --- a/xtests/run.sh +++ b/xtests/run.sh @@ -107,6 +107,11 @@ $exa $testcases/file-names-exts/music.* -I "*.OGG" -1 2>&1 | diff -q - $re $exa $testcases/file-names-exts/music.* -I "*.OGG|*.mp3" -1 2>&1 | diff -q - $results/empty || exit 1 +# Dates and times +$exa $testcases/dates -lh --accessed --sort=accessed 2>&1 | diff -q - $results/dates_accessed || exit 1 +$exa $testcases/dates -lh --sort=modified 2>&1 | diff -q - $results/dates_modified || exit 1 + + # Paths and directories # These directories are created in the VM user’s home directory (the default # location) when a Cargo build is done.