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

Unified Diff: third_party/zlib/google/zip_reader.h

Issue 99333019: Preserve modification timestamp when zipping files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better comments, cleanup Created 7 years 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 | « third_party/zlib/google/zip.cc ('k') | third_party/zlib/google/zip_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/zlib/google/zip_reader.h
diff --git a/third_party/zlib/google/zip_reader.h b/third_party/zlib/google/zip_reader.h
index a1f470421525197a68b04bc3bd10a2d8257f467c..a3e1ee82080c17a19351bd6c6b11e2d0710b4158 100644
--- a/third_party/zlib/google/zip_reader.h
+++ b/third_party/zlib/google/zip_reader.h
@@ -57,7 +57,15 @@ class ZipReader {
// Returns 0 if the entry is a directory.
int64 original_size() const { return original_size_; }
- // Returns the last modified time.
+ // Returns the last modified time. If the time stored in the zip file was
+ // not valid, the unix epoch will be returned.
+ //
+ // The time stored in the zip archive uses the MS-DOS date and time format.
+ // http://msdn.microsoft.com/en-us/library/ms724247(v=vs.85).aspx
+ // As such the following limitations apply:
+ // * only years from 1980 to 2107 can be represented.
+ // * the time stamp has a 2 second resolution.
+ // * there's no timezone information, so the time is interpreted as local.
base::Time last_modified() const { return last_modified_; }
// Returns true if the entry is a directory.
@@ -127,7 +135,8 @@ class ZipReader {
// instead. Returns true on success. OpenCurrentEntryInZip() must be
// called beforehand.
//
- // This function does not preserve the timestamp of the original entry.
+ // This function preserves the timestamp of the original entry. If that
+ // timestamp is not valid, the timestamp will be set to the current time.
bool ExtractCurrentEntryToFilePath(const base::FilePath& output_file_path);
// Extracts the current entry to the given output directory path using
@@ -138,6 +147,9 @@ class ZipReader {
//
// Returns true on success. OpenCurrentEntryInZip() must be called
// beforehand.
+ //
+ // This function preserves the timestamp of the original entry. If that
+ // timestamp is not valid, the timestamp will be set to the current time.
bool ExtractCurrentEntryIntoDirectory(
const base::FilePath& output_directory_path);
« no previous file with comments | « third_party/zlib/google/zip.cc ('k') | third_party/zlib/google/zip_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698