Buggy code:
protected class AntFTPFile { private FTPClient client ; private String curpwd ; private FTPFile ftpFile ; private FTP . FTPDirectoryScanner . AntFTPFile parent = null ; private boolean relativePathCalculated = false ; private boolean traversesSymlinks = false ; private String relativePath = "" ; public AntFTPFile ( FTPClient client , FTPFile ftpFile , String curpwd ) { } public AntFTPFile ( FTP . FTPDirectoryScanner . AntFTPFile parent , String path ) { } private String findPathElementCaseUnsensitive ( String parentPath , String soughtPathElement ) { } public boolean exists ( ) { } public String getLink ( ) { } public String getName ( ) { } public String getAbsolutePath ( ) { } public String getFastRelativePath ( ) { } public String getRelativePath ( ) throws IOException , BuildException { } private String getRelativePath ( String currentPath , String currentRelativePath ) { } public FTPFile getFile ( FTPFile [ ] theFiles , String lastpathelement ) { } public boolean isDirectory ( ) { } public boolean isSymbolicLink ( ) { } protected FTPClient getClient ( ) { } protected void setCurpwd ( String curpwd ) { } public String getCurpwd ( ) { } public boolean isTraverseSymlinks ( ) throws IOException , BuildException { } } protected class AntFTPRootFile extends FTP . FTPDirectoryScanner . AntFTPFile { private String remotedir ; public AntFTPRootFile ( FTPClient aclient , String remotedir ) { } public String getAbsolutePath ( ) { } public String getRelativePath ( ) throws IOException , BuildException { } } } private boolean isFunctioningAsDirectory ( FTPClient ftp , String dir , FTPFile file ) { } private boolean isFunctioningAsFile ( FTPClient ftp , String dir , FTPFile file ) { } public void setRemotedir ( String dir ) { } public void setServer ( String server ) { } public void setPort ( int port ) { } public void setUserid ( String userid ) { } public void setPassword ( String password ) { } public void setBinary ( boolean binary ) { } public void setPassive ( boolean passive ) { } public void setVerbose ( boolean verbose ) { } public void setNewer ( boolean newer ) { } public void setTimeDiffMillis ( long timeDiffMillis ) { } public void setTimeDiffAuto ( boolean timeDiffAuto ) { } public void setPreserveLastModified ( boolean preserveLastModified ) { } public void setDepends ( boolean depends ) { } public void setSeparator ( String separator ) { } public void setChmod ( String theMode ) { } public void setUmask ( String theUmask ) { } public void addFileset ( FileSet set ) { } public void setAction ( String action ) throws BuildException { } public void setAction ( FTP . Action action ) throws BuildException { } public void setListing ( File listing ) { } public void setSkipFailedTransfers ( boolean skipFailedTransfers ) { } public void setIgnoreNoncriticalErrors ( boolean ignoreNoncriticalErrors ) { } protected void checkConfiguration ( ) throws BuildException { } protected int transferFiles ( FTPClient ftp , FileSet fs ) throws IOException , BuildException { } protected void transferFiles ( FTPClient ftp ) throws IOException , BuildException { } protected String resolveFile ( String file ) { } protected void createParents ( FTPClient ftp , String filename ) throws IOException , BuildException { } private long getTimeDiff ( FTPClient ftp ) { long returnValue = 0 ; File tempFile = findFileName ( ftp ) ; try { fileUtils . createNewFile ( tempFile ) ; long localTimeStamp = tempFile . lastModified ( ) ; BufferedInputStream instream = new BufferedInputStream ( new FileInputStream ( tempFile ) ) ; ftp . storeFile ( tempFile . getName ( ) , instream ) ; instream . close ( ) ; boolean success = FTPReply . isPositiveCompletion ( ftp . getReplyCode ( ) ) ; if ( success ) { FTPFile [ ] ftpFiles = ftp . listFiles ( tempFile . getName ( ) ) ; if ( ( ftpFiles . length ) == 1 ) { long remoteTimeStamp = ftpFiles [ 0 ] . getTimestamp ( ) . getTime ( ) . getTime ( ) ; <START_BUG> returnValue = remoteTimeStamp - localTimeStamp ; <END_BUG> } ftp . deleteFile ( ftpFiles [ 0 ] . getName ( ) ) ; } Delete mydelete = ( ( Delete ) ( getProject ( ) . createTask ( "delete" ) ) ) ; mydelete . setFile ( tempFile . getCanonicalFile ( ) ) ; mydelete . execute ( ) ; } catch ( Exception e ) { throw new BuildException ( e , getLocation ( ) ) ; } return returnValue ; } private File findFileName ( FTPClient ftp ) { } protected boolean isUpToDate ( FTPClient ftp , File localFile , String remoteFile ) throws IOException , BuildException { } protected void doSiteCommand ( FTPClient ftp , String theCMD ) throws IOException , BuildException { } protected void sendFile ( FTPClient ftp , String dir , String filename ) throws IOException , BuildException { } protected void delFile ( FTPClient ftp , String filename ) throws IOException , BuildException { } protected void rmDir ( FTPClient ftp , String dirname ) throws IOException , BuildException { } protected void getFile ( FTPClient ftp , String dir , String filename ) throws IOException , BuildException { } protected void listFile ( FTPClient ftp , BufferedWriter bw , String filename ) throws IOException , BuildException { } protected void makeRemoteDir ( FTPClient ftp , String dir ) throws IOException , BuildException { } private void handleMkDirFailure ( FTPClient ftp ) throws BuildException { } public void execute ( ) throws BuildException { } public static class Action extends EnumeratedAttribute { private static final String [ ] VALID_ACTIONS = new String [ ] { "send" , "put" , "recv" , "get" , "del" , "delete" , "list" , "mkdir" , "chmod" , "rmdir" } ; public String [ ] getValues ( ) { } public int getAction ( ) { } } }

Fix:
returnValue = localTimeStamp - remoteTimeStamp ;