Skip to main content

Command Palette

Search for a command to run...

JAVA : System.currentTimeMillis()

Updated
1 min read
JAVA : System.currentTimeMillis()
S

I love learning about technology and sharing that with others

System.currentTimeMillis()

  • returns current value of running java virtual machine high resolution time source in nanoseconds.
  • The value returned represents nanoseconds since some fixed but arbitrary origin time,
  • other jvm instance will use different origin. Origin is nothing but used to keep track of the time from the start of the jvm
  • long startTime=System.currentTimeMillis();
    //output : 1663132233612
    
How to use this
 long startTime = System.nanoTime(); 
   // ... the code being measured ...   
 long estimatedTime = System.nanoTime() - startTime;
73 views

More from this blog

H

hashcodehub

271 posts

Consistent, Passionate and Organized :)