summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 16:13:53 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-24 16:13:53 +0000
commit5ef32389474a8c9db4bbdada978e0e9e07b0bdd0 (patch)
treefec5d9fd21f108ad6012a86b36c90ad82cb43d90 /base
parenta8804826f80de85728173e1172fb569fdf9d466a (diff)
downloadchromium_src-5ef32389474a8c9db4bbdada978e0e9e07b0bdd0.zip
chromium_src-5ef32389474a8c9db4bbdada978e0e9e07b0bdd0.tar.gz
chromium_src-5ef32389474a8c9db4bbdada978e0e9e07b0bdd0.tar.bz2
Adding last modified time to file_util
Original review: http://codereview.chromium.org/160050 Patch by dhg@google.com Review URL: http://codereview.chromium.org/159347 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21533 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/file_util.h4
-rw-r--r--base/file_util_posix.cc1
-rw-r--r--base/file_util_win.cc2
3 files changed, 7 insertions, 0 deletions
diff --git a/base/file_util.h b/base/file_util.h
index 35b9dd5..9e2636e7 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -29,6 +29,7 @@
#include "base/file_path.h"
#include "base/scoped_ptr.h"
#include "base/string16.h"
+#include "base/time.h"
namespace base {
class Time;
@@ -337,6 +338,9 @@ struct FileInfo {
// True if the file corresponds to a directory.
bool is_directory;
+ // The last modified time of a file.
+ base::Time last_modified;
+
// Add additional fields here as needed.
};
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 58454cf..6642eaa 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -525,6 +525,7 @@ bool GetFileInfo(const FilePath& file_path, FileInfo* results) {
return false;
results->is_directory = S_ISDIR(file_info.st_mode);
results->size = file_info.st_size;
+ results->last_modified = base::Time::FromTimeT(file_info.st_mtime);
return true;
}
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 91b9e2b..c83322e 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -547,6 +547,8 @@ bool GetFileInfo(const FilePath& file_path, FileInfo* results) {
results->is_directory =
(attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
+ results->last_modified = base::Time::FromFileTime(attr.ftLastWriteTime);
+
return true;
}