[ 
https://issues.apache.org/jira/browse/NET-645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16207895#comment-16207895
 ] 

Ilya Basin edited comment on NET-645 at 10/17/17 4:47 PM:
----------------------------------------------------------

If you measure elapsed times with currentTimeMillis() and the user sets OS 
date, the measurements become inaccurate, so it's a bug.

In our case, if FTPClient is configured to send keepalives as rare as possible 
and the user resets the OS date to some earlier value right before FTPClient 
calls currentTimeMillis(), then keepalive won't be sent and the file transfer 
will fail.



was (Author: basinilya):
If you measure elapsed times with currentTimeMillis() and the user sets OS 
date, the measurements become inaccurate, so it's a bug.

In our case, if FTPClient is configured to send keepalives as rare as possible 
and the user resets the OS date to some earlier value right before FTPClient 
calls currentTimeMillis(), then keepalive won't be sent and the FTP will fail.


> Use System.nanoTime() to measure time intervals
> -----------------------------------------------
>
>                 Key: NET-645
>                 URL: https://issues.apache.org/jira/browse/NET-645
>             Project: Commons Net
>          Issue Type: Wish
>          Components: FTP
>    Affects Versions: 3.6
>            Reporter: Ilya Basin
>
> At least in org.apache.commons.net.ftp.FtpClient
> System.nanoTime()
> should be used instead of
> System.currentTimeMillis()
> I see that commons-net-3.6.jar is targeted for java 6. So nanoTime() is 
> available.
> {code}
> $ javap -v -classpath commons-net-3.6 org.apache.commons.net.ftp.FtpClient | 
> grep "major version"
> Warning: Binary file org.apache.commons.net.ftp.FtpClient contains 
> org.apache.commons.net.ftp.FTPClient
>   major version: 50
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to