Index: storage/browser/fileapi/file_stream_reader.cc |
diff --git a/storage/browser/fileapi/file_stream_reader.cc b/storage/browser/fileapi/file_stream_reader.cc |
index cb87ecb939ba4b96a5d6f56a565626b8ece0c47e..00d3e22bd00cf1b532887ed3ddfcc1de083703fa 100644 |
--- a/storage/browser/fileapi/file_stream_reader.cc |
+++ b/storage/browser/fileapi/file_stream_reader.cc |
@@ -8,13 +8,18 @@ |
namespace storage { |
+// Int64->double->int64 conversions (e.g. through Blink) may lose some |
+// precision in the microsecond range. Allow 10us delta. |
+const int kModificationTimeAllowedDeltaMicroseconds = 10; |
+ |
// Verify if the underlying file has not been modified. |
bool FileStreamReader::VerifySnapshotTime( |
const base::Time& expected_modification_time, |
const base::File::Info& file_info) { |
return expected_modification_time.is_null() || |
- expected_modification_time.ToTimeT() == |
- file_info.last_modified.ToTimeT(); |
+ (expected_modification_time - file_info.last_modified) |
+ .magnitude() |
+ .InMicroseconds() < kModificationTimeAllowedDeltaMicroseconds; |
} |
} // namespace storage |