ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martijn Kruithof ...@kruithof.xs4all.nl>
Subject Re: FTP.isUpToDate()
Date Mon, 16 May 2005 08:26:30 GMT
Steve Cohen wrote:

> In trying to bring over new commons-net timezone functionaility, I 
> discover the following:
>
>    protected boolean isUpToDate(FTPClient ftp, File localFile,
>                                 String remoteFile)
>         throws IOException, BuildException {
> ...
>        if (this.action == SEND_FILES) {
>            return remoteTimestamp + timeDiffMillis > localTimestamp;
>        } else {
>            return localTimestamp > remoteTimestamp + timeDiffMillis;
>        }
>    }
>
> Off the top of my head, and given the general logic associated with 
> the name of the method, can anyone think of a reason why the two 
> greater-than signs in the above code should not be greater-than-or-equal?
>
> In the test case I am developing from the new code, my first iteration 
> didn't produce the expected results.  I expected one or two files to 
> be gotten, not the entire directory of 300 files.  When I changed the 
> >'s above to >='s, the code worked as expected.  Can anyone see 
> something I'm missing?

Hi

Depends on what error is actually wanted. I'd expect
remoteTimestamp + timeDiff + (remote)granularity > localTimestamp - 
(local)granularity
when no risk is to be taken that the file is not copied while it should 
have been
or
remoteTimestamp + timeDiff - (remote)granularity >= localTimestamp + 
(local)granularity
when no rist is to be taken that the file is copied while it should not 
have been.

When leaving out the granularity I'd say you are right an >= should 
always be used.

Martijn

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message