在 C# 中使用 SharpZipLib,我正在使用:
// ..
ZipEntry entry = new ZipEntry(Path.GetFileName(files[i].fullfilename));
entry.DateTime =files[i].datemodified //has everything including milliseconds
//.. some more code which i'm not writing
zip 文件创建得很好,但是当我使用任何 3rd 方解压缩器解压缩它时,我看到文件在文件的修改日期丢失了毫秒信息(毫秒信息对我来说非常重要)。我看到了 ZipEntry 的代码及其 DateTime 属性: https ://github.com/icharpcode/SharpZipLib/blob/c49a22d70a77819b1dc88309c91e99565aa9099b/src/Zip/ZipEntry.cs#L695
您会看到在 zip 文件中作为此条目的日期时间写入的是: https ://github.com/icsharpcode/SharpZipLib/blob/c49a22d70a77819b1dc88309c91e99565aa9099b/src/Zip/ZipOutputStream.cs#L344 这是ms dos 格式化时间。有人可以帮我告诉我如何写这个,以便最终的压缩文件包含我从文件信息的“LastWriteTime”获得的原始日期时间中的修改日期时间中的所有内容。
谢谢。