简体   繁体   English

c#GzipStream中压缩文件的时间戳

[英]Timestamp of compressed file in c# GzipStream

I am using the gzipstream to compress my file in c#. 我正在使用gzipstream在c#中压缩我的文件。 While the gz file has the proper timestamp, the actual file shows the UTC time stamp when decompressed. 尽管gz文件具有正确的时间戳,但实际文件在解压缩后会显示UTC时间戳。 Is there a way to get the current system timezone and set it on the file to be compressed ? 有没有办法获取当前系统时区并将其设置在要压缩的文件上?

I am using the same code in the example at http://msdn.microsoft.com/en-us/library/system.io.compression.compressionmode.aspx 我在http://msdn.microsoft.com/zh-cn/library/system.io.compression.compressionmode.aspx的示例中使用了相同的代码

Realized that the time stamp was wrong only when I unzipped using Winrar software. 意识到只有当我使用Winrar软件解压缩时,时间戳才是错误的。 When I unzipped using 7zip, the file had the proper time stamp. 当我使用7zip解压缩时,文件具有正确的时间戳。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM