开发者

FTP Last file write time - wininet.dll C# wrapper - Date is one year previous

Im using the following library http://ftplib.codeplex.com/ which is a wrapper around wininet.dll to perform some FTP commands.

The resultant app is working perfectly on 3 Windows XP machines. However the same app running on two different Server 2003 machines is having issues.

Any file that has a last modified date of less than 12 ho开发者_运维知识库urs ago, ends up with a last modified date of 12 months previous to what it actually is. I am using the following code to convert from the FILETIME structure to a datetime. This is working fine, it is the actual passed in values that are wrong

uint low = (uint)time.dwLowDateTime;
long ft = (((long)time.dwHighDateTime) << 32 | low);
DateTime.FromFileTimeUtc(ft));
return DateTime.FromFileTimeUtc(ft);

Below is some trace output to verify the inputs. The actual filetime on the files when viewed on an ftp program are 30 minutes apart, not a year.

Windows filetime = 129490226400000000
Converted To = 4/05/2011 10:44:00 p.m.
Windows filetime = 129174884400000000
Converted To = 4/05/2010 11:14:00 p.m.

I have looked at the regional settings and time zones on all test machines and they are the same. All tests have been done to the same FTP server, with the same files being compared. From what I have read wininet.dll is the same version in XP as Server 2003. Does anyone have any ideas why the filetime we are getting is wrong?

P.S I have read of issues with ftp servers returning only day and month values, and this can cause issues when getting files from the end of the previous year, early in a new year and having the files date values come through one year in the future, but this seems unrelated, as it is specific to different ftp client environments, and is one year in the past, and the files were created the day previous.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜