Opened 20 years ago

Last modified 11 years ago

#2221 closed Feature request

Allow time zone specification

Reported by: mamandel Owned by:
Priority: normal Component: FileZilla Client
Keywords: Cc: mamandel, tonylaundrie, antonyclark, Tim Kosse, Alexander Schuch
Component version: Operating system type:
Operating system version:

Description

I normally use the option "overwrite if newer". When I
connect to a server in a different time zone, that server
uses its local time as the date of the file. FileZilla
compares that timestamp with the timestamp on my
machine and often makes a wrong decision about which
file is newer. If I could associate a time zone with each
site I would be able to trust the overwrite option
without having to remember what time zone a site is in.

A "time zone differential" setting for each site would also
be useful, but only so long as I was using FileZilla from
my home or office, not while I am traveling and using my
laptop.

If FileZilla already has such an option, it is well hidden
and not indexed in the help file.

Change History (4)

comment:1 by tonylaundrie, 19 years ago

Here's a way to fix the "overwrite if newer" feature.
It was implemented in a perl script that I wrote for
maintaining a web site from either home or work.
See http://laundrie.org/mirror.txt for the full perl
script. Some pertinent lines are below. Sorry I don't
have the required environment to implement the changes
myself.

After opening an ftp connection, calculate the difference
between the current remote time and the current local time
to account for system clock mismatches,
whether caused by a time zone difference or just a way-off
clock.
Since time reported by ftp->ls doesn't account for seconds, a
file
must be at least 2 minutes newer than another to trigger a
copy.
We always set the file modification time of local files to the
time stamp of the remote file after a transfer.

Any file older than 5 months old is considered "very old."
Time
differences between files that are both very old will not trigger
a
transfer. You need to "touch" files that you really want to
transfer.
This is to avoid the problem of files occasionally being
tranfered
as they age past 6 months, which is when ls reports time
with only
day granularity instead of second granularity.

A "synctime" command can be used to set the modification
times of all local
files to the modification times of all remote files. This is
especially
useful for older Windows machines right after Daylight
Savings Time starts
or stops. File modification times on Windows FAT file
systems will
appear to change by plus or minus one hour after DST stops
or starts.
Use this feature to sync the times to the remote (hopefully
Unix) machine.

# Parameters:

$dummy_src = "/dev/null"; # local name of dummy file
to send for

# checking

time difference.
$dummy_dst = "dummy"; # remote name
of dummy file, don't prepend ./
$diff_threshold = 120; # Difference in file times to
trigger a copy.
$veryold = 5*30*24*60*60; # 5 months of seconds.

...

print "Starting ftp connection...\n";
# Make ftp connection.
$ftp = Net::FTP->new($remote_site, Debug=>$debug,

Passive=>1)

die "Could not connect, $@";

if ($remote_user) {

if ($remote_pw) {

$ftp->login($remote_user, $remote_pw)
die "Could not

login, ",

$ftp->message;

} else {

$ftp->login($remote_user)

message;

die "Could not login, ", $ftp-

}

} else {

$ftp->login()
die "Could not login, ", $ftp->message;

}

$ftp->cwd($remote_root)
die "Could not remotely cd

$remote_root, ",

$ftp->message;

$ftp->binary();

# To save ftp traffic, I don't want to call ftp->mdtm on every
file. I want
# to use the date/time from the "dir -RA" command instead.
Either way, I
# need to calculate the difference in system clocks, whether
a time zone
# difference or a screwed up clock.

print "Checking time difference...\n";

$ftp->put($dummy_src, $dummy_dst)
die "Could not put

dummy file, ",

$ftp->message;

$timenow = time();
@rta = $ftp->dir("dummy");

$ftp->delete($dummy_dst)
die "Could not delete dummy

file: ", $ftp->message;

($loc_sec, $loc_min, $loc_hour, $loc_day, $loc_month,
$loc_year) = gmtime($timenow);
$loc_year += 1900;
(undef, undef, undef, undef, undef, $rem_month, $rem_day,
$t, $f) =

split(' ', $rta[0], 9);

if ($f ne $dummy_dst) {

print "Error: Saw: $rta[0]\n";
print "Error: Expected to see $dummy_dst at end of line.\n";
exit 1;

}
$rem_month = $mo2num{$rem_month};
$rem_year = $loc_year;
($rem_hour, $rem_min) = split(':', $t, 2);
$rt = timegm
(0,$rem_min,$rem_hour,$rem_day,$rem_month,$rem_year-
1900);
$dt = $rt - $timenow;

# $dt should now be subtracted from all the times reported by
ftp so that
# they line up with local time. When determining if a file
is "newer", if
# abs(remote_time - local_time) < diff_threshold, then
consider neither one
# newer. After executing
# a transfer in either direction, set the modification time of the
file
# on the local system equal to that on the remote file as
reported by ftp.
#
# When using the "newer" feature, report a warning about
files that have
# similar timestamps but have different file sizes.

comment:2 by antonyclark, 19 years ago

The time difference can be determined automatically and
accurately by sending an empty file to the server and
reading its directory listing.

comment:3 by Tim Kosse, 19 years ago

It is possible to set the server timezone in the site manager.

comment:4 by Alexander Schuch, 18 years ago

The site manager of FileZilla 3 (beta) can set a time offset for each site.

Having FileZilla auto-detect the time offset is requested already:
[ 1723196 ] Calculate timezone offset automatically

Note: See TracTickets for help on using tickets.