Alex Rivera | Logout

How to measure the a time-span in seconds using System.currentTimeMillis()?

Asked 2011-06-11T18:27:57.523
61

How to convert System.currentTimeMillis(); to seconds?

long start6=System.currentTimeMillis();
System.out.println(counter.countPrimes(100000000)+" for "+start6);

The console shows me 5761455 for 1307816001290. I can't read how many seconds that is.

Any help?

Edit
Report

2 Answers

16

like so:

(int)(milliseconds / 1000)
answered 2011-06-11T19:04:28.967
2
TimeUnit.SECONDS.convert(start6, TimeUnit.MILLISECONDS);
answered 2013-07-18T09:24:44.070

Your Answer