Chromium Code Reviews| Index: base/platform_file_posix.cc |
| diff --git a/base/platform_file_posix.cc b/base/platform_file_posix.cc |
| index 056577c58172740fa886b031f2586cf677e18268..3c13febeef37bfdd94c4229985fdf7f612f78518 100644 |
| --- a/base/platform_file_posix.cc |
| +++ b/base/platform_file_posix.cc |
| @@ -29,7 +29,7 @@ COMPILE_ASSERT(PLATFORM_FILE_FROM_BEGIN == SEEK_SET && |
| namespace { |
| -#if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) |
|
pasko
2013/08/21 14:40:58
nacl has largefile with so this should be OK, than
|
| +#if defined(OS_BSD) || defined(OS_MACOSX) |
| typedef struct stat stat_wrapper_t; |
| static int CallFstat(int fd, stat_wrapper_t *sb) { |
| base::ThreadRestrictions::AssertIOAllowed(); |
| @@ -380,49 +380,19 @@ bool GetPlatformFileInfo(PlatformFile file, PlatformFileInfo* info) { |
| info->is_symbolic_link = S_ISLNK(file_info.st_mode); |
| info->size = file_info.st_size; |
| -#if defined(OS_LINUX) |
| - const time_t last_modified_sec = file_info.st_mtim.tv_sec; |
| - const int64 last_modified_nsec = file_info.st_mtim.tv_nsec; |
| - const time_t last_accessed_sec = file_info.st_atim.tv_sec; |
| - const int64 last_accessed_nsec = file_info.st_atim.tv_nsec; |
| - const time_t creation_time_sec = file_info.st_ctim.tv_sec; |
| - const int64 creation_time_nsec = file_info.st_ctim.tv_nsec; |
| +#if defined(OS_MACOSX) |
| + info->last_modified = base::Time::FromTimeSpec(file_info.st_mtimespec); |
| + info->last_accessed = base::Time::FromTimeSpec(file_info.st_atimespec); |
| + info->creation_time = base::Time::FromTimeSpec(file_info.st_ctimespec); |
| #elif defined(OS_ANDROID) |
| - const time_t last_modified_sec = file_info.st_mtime; |
| - const int64 last_modified_nsec = file_info.st_mtime_nsec; |
| - const time_t last_accessed_sec = file_info.st_atime; |
| - const int64 last_accessed_nsec = file_info.st_atime_nsec; |
| - const time_t creation_time_sec = file_info.st_ctime; |
| - const int64 creation_time_nsec = file_info.st_ctime_nsec; |
| -#elif defined(OS_MACOSX) || defined(OS_IOS) || defined(OS_BSD) |
| - const time_t last_modified_sec = file_info.st_mtimespec.tv_sec; |
| - const int64 last_modified_nsec = file_info.st_mtimespec.tv_nsec; |
| - const time_t last_accessed_sec = file_info.st_atimespec.tv_sec; |
| - const int64 last_accessed_nsec = file_info.st_atimespec.tv_nsec; |
| - const time_t creation_time_sec = file_info.st_ctimespec.tv_sec; |
| - const int64 creation_time_nsec = file_info.st_ctimespec.tv_nsec; |
| + info->last_modified = base::Time::FromTimeT(file_info.st_mtime); |
| + info->last_accessed = base::Time::FromTimeT(file_info.st_atime); |
| + info->creation_time = base::Time::FromTimeT(file_info.st_ctime); |
| #else |
| - // TODO(gavinp): Investigate a good high resolution option for OS_NACL. |
| - const time_t last_modified_sec = file_info.st_mtime; |
| - const int64 last_modified_nsec = 0; |
| - const time_t last_accessed_sec = file_info.st_atime; |
| - const int64 last_accessed_nsec = 0; |
| - const time_t creation_time_sec = file_info.st_ctime; |
| - const int64 creation_time_nsec = 0; |
| + info->last_modified = base::Time::FromTimeSpec(file_info.st_mtim); |
| + info->last_accessed = base::Time::FromTimeSpec(file_info.st_atim); |
| + info->creation_time = base::Time::FromTimeSpec(file_info.st_ctim); |
| #endif |
| - |
| - info->last_modified = |
| - base::Time::FromTimeT(last_modified_sec) + |
| - base::TimeDelta::FromMicroseconds(last_modified_nsec / |
| - base::Time::kNanosecondsPerMicrosecond); |
| - info->last_accessed = |
| - base::Time::FromTimeT(last_accessed_sec) + |
| - base::TimeDelta::FromMicroseconds(last_accessed_nsec / |
| - base::Time::kNanosecondsPerMicrosecond); |
| - info->creation_time = |
| - base::Time::FromTimeT(creation_time_sec) + |
| - base::TimeDelta::FromMicroseconds(creation_time_nsec / |
| - base::Time::kNanosecondsPerMicrosecond); |
| return true; |
| } |