jamesbrowder / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Stopwatch.elapsedTime(TimeUnit) hardcoded to NANOSECONDS #727

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use the Stopwatch to time something
2. make a call to elapsedTime(TimeUnit) and supply a TimeUnit other than 
NANOSECONDS

What is the expected output? What do you see instead?
Expect to see the elapsed time in the specified TimeUnit.  Instead, it is 
always returned in NANOSECONDS

What version of the product are you using? On what operating system?
release 10.0 on OS X 10.7.2

Please provide any additional information below.
Looking at the associated source code for this release revealed the problem: 

  public long elapsedTime(TimeUnit desiredUnit) {
    return desiredUnit.convert(elapsedNanos(), NANOSECONDS);
  }

Original issue reported on code.google.com by jonathan...@gmail.com on 30 Sep 2011 at 12:26

GoogleCodeExporter commented 9 years ago
"desiredUnit.convert(elapsedNanos(), NANOSECONDS)"

This converts the elapsed nanoseconds to the desired time unit you pass in. So 
it's working correctly.

Original comment by cgdec...@gmail.com on 30 Sep 2011 at 2:23

GoogleCodeExporter commented 9 years ago

Original comment by kevinb@google.com on 30 Sep 2011 at 2:32

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09