EmitTimesInWindowsFormatWhenSaving Property

DotNetZip

Ionic Zip Library v1.9.1.6 EmitTimesInWindowsFormatWhenSaving Property
ReferenceIonic.ZipZipEntryEmitTimesInWindowsFormatWhenSaving
Specifies whether the Creation, Access, and Modified times for the given entry will be emitted in "Windows format" when the zip archive is saved.
Declaration Syntax
C# Visual Basic Visual C++
public bool EmitTimesInWindowsFormatWhenSaving { get; set; }
Public Property EmitTimesInWindowsFormatWhenSaving As Boolean
	Get
	Set
public:
property bool EmitTimesInWindowsFormatWhenSaving {
	bool get ();
	void set (bool value);
}
Remarks

An application creating a zip archive can use this flag to explicitly specify that the file times for the entry should or should not be stored in the zip archive in the format used by Windows. The default value of this property is true.

When adding an entry from a file or directory, the Creation (CreationTime), Access (AccessedTime), and Modified (ModifiedTime) times for the given entry are automatically set from the filesystem values. When adding an entry from a stream or string, all three values are implicitly set to DateTime.Now. Applications can also explicitly set those times by calling SetEntryTimes(DateTime, DateTime, DateTime).

PKWARE's zip specification describes multiple ways to format these times in a zip file. One is the format Windows applications normally use: 100ns ticks since Jan 1, 1601 UTC. The other is a format Unix applications typically use: seconds since January 1, 1970 UTC. Each format can be stored in an "extra field" in the zip entry when saving the zip archive. The former uses an extra field with a Header Id of 0x000A, while the latter uses a header ID of 0x5455.

Not all zip tools and libraries can interpret these fields. Windows compressed folders is one that can read the Windows Format timestamps, while I believe the Infozip tools can read the Unix format timestamps. Although the time values are easily convertible, subject to a loss of precision, some tools and libraries may be able to read only one or the other. DotNetZip can read or write times in either or both formats.

The times stored are taken from ModifiedTime, AccessedTime, and CreationTime.

This property is not mutually exclusive from the EmitTimesInUnixFormatWhenSaving property. It is possible that a zip entry can embed the timestamps in both forms, one form, or neither. But, there are no guarantees that a program running on Mac or Linux will gracefully handle NTFS Formatted times, or that a non-DotNetZip-powered application running on Windows will be able to handle file times in Unix format. When in doubt, test.

Normally you will use the ZipFile.EmitTimesInWindowsFormatWhenSaving property, to specify the behavior for all entries in a zip, rather than the property on each individual entry.

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: 1.9.1.8 (1.9.1.8)