Timezone (SITE ZONE) support

Hi, is it possible to add a property that returns the FTP servers timezone, i.e. what's returned from SITE ZONE less the UTC prefix. The reason I ask is that some (annoying and non-compliant) FTP servers our customers have assume the date & time passed with MDTM is a local date & time and not UTC. In this case we need to know what timezone it's in so we can adjust it accordingly. Better yet, if you could add a new SetFileTime method, e.g. SetFileTimeEx, to take this automatically into account it would be great. We could do this manually, but I'm sure others would find such a feature very useful. At the moment the user needs to state that the FTP server is non-compliant as it's not possible to know (although if they support MLST/MLSD then they always return the date & times in UTC). Thanks.

Hello ..

What FTP server returns the the local time in the MDTM reply and supports the SIZE ZONE command? ServU? Version?


Hi, one example is GlobalSCAPE Secure FTP Server. It is taking the value passed with MDTM as a local date & time (in its timezone), but it is returning it (in MLSD) as the value passed in MDTM. For example:

215 UNIX Type: L8
211-Features supported:
COMB target;source_list
XCRC filename;start;end
MLST Size*;Modify*;Create;Type*;Unique;Perm*;Lang;Media-Type;CharSet;
211 END
MDTM 20060322063927 test1.txt
213 New file modification time is set: 20060322063927

The UTC date & time is passed via MDTM. But when it's read back from via MLSD it's returning the wrong value. Once converted to the local timezone it's off by 8 hours, which just happens to be the timezone the FTP server is in. So if I pass the MDTM 8 hours off in the other direction then it works (i.e. cancel out it's offset). The FTP server doesn't support SITE ZONE in this case but the user can manually say which zone the server is in in our client software (to get around problems like this).

Running exactly the same test (same files, same timezone) with Serv-U (and others, e.g. Raiden) there's no problem:

MDTM 20060322063927 test1.txt
253 Date/time changed okay.

MLSD returns the correct date & time.

You may also find the following helpful:

http://www.indyproject.org/Sockets/Blog ... _15.en.iwp

It explains the SITE UTIME and MFMT extensions. Not sure if you use those or not, but with Indy (as he explains) if the FTP server supports MFMT then that is used instead of MDTM.

Thanks. Nice article. But what server actually supports the MFMT feature?
Edit: The next version of the FTP Library will prefer MFTM instead of MDTM if available.

If there is a reliable way to detect gFTP and ncftp we can implement the SITE UTIME commands.

Edit: Pure FTP Server supports SITE UTIME as well:
http://freshmeat.net/projects/pure-ftpd ... _id=220345

Still the question remains how to detect the commands. Are they announced in the FEAT reply?