Ionic.Zip Date Problems.
-
I have code which unzips a file over others, but first checks the date of a special file to make sure it is newer. The ModifiedTime of the file is found using:
using (ZipFile zip = ZipFile.Read(OriginalFileName))
try
{
ZipEntry z = zip["save_history.log"];
NewFileAge = z.ModifiedTime;
}
catch......WinZip shows the date of the file as 26/02/2019 3:56 PM. Extraction confirms this. The value of NewFileAge in the code above is 26/02/2019 2:56 PM. The only references I can find to this refer to remote servers in different time zones. All these files are on one computer. Yes, it looks suspiciously like a daylight saving time issue, but I can't figure out how.
-
I have code which unzips a file over others, but first checks the date of a special file to make sure it is newer. The ModifiedTime of the file is found using:
using (ZipFile zip = ZipFile.Read(OriginalFileName))
try
{
ZipEntry z = zip["save_history.log"];
NewFileAge = z.ModifiedTime;
}
catch......WinZip shows the date of the file as 26/02/2019 3:56 PM. Extraction confirms this. The value of NewFileAge in the code above is 26/02/2019 2:56 PM. The only references I can find to this refer to remote servers in different time zones. All these files are on one computer. Yes, it looks suspiciously like a daylight saving time issue, but I can't figure out how.
Which ZIP library are you using? The one in the .NET Framework doesn't have a .Read method. Consult the documentation on that library. I'd be willing to bet the date/time you got back for the zip file entry is in UTC and you're comparing it to a local date/time.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
Which ZIP library are you using? The one in the .NET Framework doesn't have a .Read method. Consult the documentation on that library. I'd be willing to bet the date/time you got back for the zip file entry is in UTC and you're comparing it to a local date/time.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak