Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: net/disk_cache/simple/simple_util.cc

Issue 22582009: Improve time resolution in PlatformFileInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one more TODO for gavinp Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/simple/simple_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/simple/simple_util.cc
diff --git a/net/disk_cache/simple/simple_util.cc b/net/disk_cache/simple/simple_util.cc
index 40d3894d4e6c435f20f946e088858a169844d6ae..72a4612271f50f6d790e687bb5ae8abe9e013a6f 100644
--- a/net/disk_cache/simple/simple_util.cc
+++ b/net/disk_cache/simple/simple_util.cc
@@ -21,25 +21,6 @@ namespace {
// Size of the uint64 hash_key number in Hex format in a string.
const size_t kEntryHashKeyAsHexStringSize = 2 * sizeof(uint64);
-// TODO(clamy, gavinp): this should go in base
-bool GetNanoSecsFromStat(const struct stat& st,
- time_t* out_sec,
- long* out_nsec) {
-#if defined(OS_ANDROID)
- *out_sec = st.st_mtime;
- *out_nsec = st.st_mtime_nsec;
-#elif defined(OS_LINUX)
- *out_sec = st.st_mtim.tv_sec;
- *out_nsec = st.st_mtim.tv_nsec;
-#elif defined(OS_MACOSX) || defined(OS_IOS) || defined(OS_BSD)
- *out_sec = st.st_mtimespec.tv_sec;
- *out_nsec = st.st_mtimespec.tv_nsec;
-#else
- return false;
-#endif
- return true;
-}
-
} // namespace
namespace disk_cache {
@@ -107,20 +88,6 @@ int64 GetFileOffsetFromKeyAndDataOffset(const std::string& key,
// TODO(clamy, gavinp): this should go in base
bool GetMTime(const base::FilePath& path, base::Time* out_mtime) {
DCHECK(out_mtime);
-#if defined(OS_POSIX)
- base::ThreadRestrictions::AssertIOAllowed();
- struct stat file_stat;
- if (stat(path.value().c_str(), &file_stat) != 0)
- return false;
- time_t sec;
- long nsec;
- if (GetNanoSecsFromStat(file_stat, &sec, &nsec)) {
- int64 usec = (nsec / base::Time::kNanosecondsPerMicrosecond);
- *out_mtime = base::Time::FromTimeT(sec)
- + base::TimeDelta::FromMicroseconds(usec);
- return true;
- }
-#endif
base::PlatformFileInfo file_info;
if (!file_util::GetFileInfo(path, &file_info))
return false;
« no previous file with comments | « net/disk_cache/simple/simple_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698