nfsantos commented on PR #1621:
URL: https://github.com/apache/jackrabbit-oak/pull/1621#issuecomment-2265357678

   > > System.currentTimeMillis() is not guaranteed to be monotonically 
increasing or to match the real elapsed time
   > 
   > But that is only true when somebody changed the system clock; if this 
bothers us, there are probably many places in the code base we need to adjust...
   
   Or when NTP adjusts the clock. Or in another situations that we may not be 
considering. For me the important point is that the specification of 
`System.currentTimeMillis()` does not give enough guarantees to be sure that 
the elapsed time is accurate, so I will not use it for that purpose. I don't 
think we should make assumptions about the situations where the results will be 
inaccurate and say that it will never happen in our case. It may even be true 
now, but change in the future. So I prefer to program to the specification and 
`System.nanoTime()` is what guarantees accurate calculation of elapsed time.
   
   And I do think we should not make use of `System.currentTimeMillis()` to 
measure times, but this is up to the owners of those modules to decide. The 
chances of this causing us problems are small, especially that in most cases 
the results are only used for human consumption.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to