[System.IO.Compression] Fixed Zip entries with unset last write time to return the...
[mono.git] / mcs / class / System.IO.Compression / SharpCompress / Common / Zip / ZipEntry.cs
index 6ed742eeca357f3d356466d2f7e36f4b27cd1ec7..2c0ec07e78426d580f3fcd29f61e4f53e8cb6106 100644 (file)
@@ -16,6 +16,13 @@ namespace SharpCompress.Common.Zip
                 this.filePart = filePart;
                 lastModifiedTime = Utility.DosDateToDateTime(filePart.Header.LastModifiedDate,
                                                              filePart.Header.LastModifiedTime);
+                if (lastModifiedTime == default(DateTime))
+                {
+                    // On .NET on Windows, for zip entries that don't have a last write time,
+                    // the return value for ZipArchiveEntry.LastWriteTime is:
+                    //   1/1/1980 12:00:00 AM, Ticks=624511296000000000
+                    lastModifiedTime = new DateTime(624511296000000000);
+                }
             }
         }