• Post Reply Bookmark Topic Watch Topic
  • New Topic

Clocking  RSS feed

 
P. Sagdeo
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I was wondering how would you see how long a program has been running? I've tried looking in the calendar class, but I cant seem to get it to work. Do you guys have any ideas?
 
Ram Mohan
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just start a new timer at the start of program execution with the statement:
long startTime = System.currentTimeMillis();
at the end of the program, get the current time by :
long endTime = System.currentTimeMillis();
you can then get the execution time in milliseconds which (im sorry, you have to manually convert into an appropriate format)
hope this helps
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!