title: How can I measure time in Java not susceptible to System clock changes?
body: <p>I would like to measure elapsed time in a Java. However differences in <code>System.currentTimeMillis()</code> and (I believe) <code>System.nanoTime()</code> can be changed by external changes eg someone (or the system) altering the system clock.</p>
  
  <p>Using network calls is not an option as it's possible very frequent and fast returns are required.</p>
  
  <p>Is there a common solution for this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Sorry, I should have elaborated about the reason. It isn't to stop malicious users - it's things like client initiated logout for being idle and routine client events.</p>