[
  {
    "Id": "232372",
    "ThreadId": "68322",
    "Html": "<p>Hello,</p>\r\n<p>When adding ZipEntry objects, I need to set the mtime value. This is a readonly property, and it seems the only way I could set it is by using SetNtfsTimes(). Can someone please confirm that this is indeed the only way to set this property.</p>\r\n<p>Thanks,</p>\r\n<p>Norton.</p>",
    "PostedDate": "2009-09-08T12:52:21.333-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232380",
    "ThreadId": "68322",
    "Html": "<p>That is correct.</p>\r\n<p>Rather than providing three separate setters and getters for the modified, created, and accessed time, I converged them into a single method.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-09-08T13:13:28.223-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232384",
    "ThreadId": "68322",
    "Html": "<p>Doesn't this method make an assumption that the DateTime passed in is a local time and it sets the mtime to the UTC? If someone uses the zip file as a container to save and read data, it makes it a bit inconvinient to reconstruct the container with the same data that has the same timestamps. This is&nbsp;because they would need to persist the files within the zip file with local time stamp in order to restore it back to the correct mtime. Otherwise, it will keep shifting time. This is not a big deal really, but it would have been more convenient to be able to just set the value with the exact utc timestamp.</p>\r\n<p>Thanks again,</p>\r\n<p>Norton.</p>",
    "PostedDate": "2009-09-08T13:28:18.18-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232385",
    "ThreadId": "68322",
    "Html": "This discussion has been copied to a work item. Click <a href=\"http://dotnetzip.codeplex.com/WorkItem/View.aspx?WorkItemId=8697\">here</a> to go to the work item and continue the discussion.",
    "PostedDate": "2009-09-08T13:30:27.357-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232404",
    "ThreadId": "68322",
    "Html": "<p>Hey Norton, No.&nbsp; I don't understand the issue you're raising.&nbsp; The <a href=\"http://cheeso.members.winisp.net/DotNetZipHelp/html/88576536-a56e-907b-fe2f-389dfcbf08b6.htm\">documentation for SetEntryTimes</a> says:</p>\r\n<blockquote>\r\n<p>When adding an entry from a file or directory, the Creation, Access, and Modified times for the given entry are automatically set from the filesystem values. When adding an entry from a stream or string, the values are implicitly set to DateTime.Now. The application may wish to set these values to some arbitrary value, before saving the archive. If you set the times using this method, the LastModified property also gets set, to the same value provided for mtime.</p>\r\n<p>The values you set here will be retrievable with the ModifiedTime, CreationTime and AccessedTime <span style=\"text-decoration:line-through\">read-only</span> properties.</p>\r\n<p>When this method is called, the EmitTimesInWindowsFormatWhenSaving flag is automatically set.</p>\r\n<p>DateTime values provided here without a DateTimeKind are assumed to be Local Time.</p>\r\n</blockquote>\r\n<p>The DateTime you pass in can be of any kind.&nbsp; If it is DateTimeKind.Unspecified, then it is assumed to be DateTimeKind.Local.&nbsp;&nbsp; In any case when saving the zip file, the times are formatted in UTC.&nbsp; This is an implementation detail and you shouldn't care about it.&nbsp; When the files are extracted, the times are set&nbsp;on the file as UTC.&nbsp; Depending on the way you look at the file (Windows Explorer, some other tool) it may be displayed in Local time or&nbsp;in UTC.&nbsp; The timestamp on the extracted file will be the same as the timestamp on the file that was put into the zip file, regardless of what DateTimeKind was used&nbsp;&nbsp;in any call to SetEntryTimes().&nbsp;</p>\r\n<p>Also, as the doc states, you don't have to set the creation, accessed, or modified times on a zip entry when adding a file to a zipfile.&nbsp; It's done automatically.&nbsp; You need the SetEntryTimes method only when you want to <em>override</em> the times on the entry, as, for example, when you want all files in a zip to have the same time. or, when adding entries from a stream or from a string (via AddEntry()).&nbsp;</p>\r\n<p>If you are experiencing an unexpected shift in entry times, comparing the times on the files added, versus the times on the files later extracted, that's a bug.&nbsp;&nbsp; You'll have to describe how you get this behavior.</p>\r\n<p>The workitem I opened and already closed is to make the CreationTime, AccessedTime and ModifiedTime properties read/write.&nbsp; (These havve been renamed in v1.9 from Ctime, Atime, and Mtime for clarity).&nbsp; So with the next interim binary build you will be able to individually override the file entry times.&nbsp; Of course you will still be able to use SetEntryTimes().&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-09-08T14:19:20.573-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232426",
    "ThreadId": "68322",
    "Html": "<p>I am creating entries from the stream. Do you know how to modify the Kind property of a DateTime object? I cannot even create a new DateTime object from an existing one by passing DateTimeKind.Utc. For example, when I do something like this: DateTime someDateTime = new DateTime(zipEntry.Mtime.Ticks, zipEntry.Mtime.Kind); - the someDateTime object will still have the Kind property set to DateTimeKind.Unspecified, even though the zipEntry.Mtime.Kind is Utc.</p>",
    "PostedDate": "2009-09-08T15:12:49.923-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232449",
    "ThreadId": "68322",
    "Html": "<p>My code doesn't agree with what you are reporting.</p>\r\n<p>I just tried</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre>        System.DateTime now2 = System.DateTime.UtcNow;\r\n        System.Console.WriteLine(<span style=\"color:#A31515\">&quot;now2 DateTime: {0} ({1})&quot;</span>, now2.ToString(<span style=\"color:#A31515\">&quot;G&quot;</span>), now2.Kind);\r\n\r\n        DateTime fromTicks = <span style=\"color:Blue\">new</span> DateTime(now2.Ticks, now2.Kind);\r\n        System.Console.WriteLine(<span style=\"color:#A31515\">&quot;fromTicks DateTime: {0} ({1})&quot;</span>, fromTicks.ToString(<span style=\"color:#A31515\">&quot;G&quot;</span>), fromTicks.Kind);\r\n       \r\n\r\n</pre>\r\n</div>\r\n<p>And I get the expected results. &nbsp;In both cases the Kind is Utc.</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-09-08T17:55:01.58-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]