JDK-8140384: TicksToTimeHelper::milliseconds() should return a double

Bengt Rutisson bengt.rutisson at oracle.com
Fri Oct 23 08:26:32 UTC 2015


Hi all,

Could I have  a couple of reviews for this small change?

http://cr.openjdk.java.net/~brutisso/8140384/webrev.00/
https://bugs.openjdk.java.net/browse/JDK-8140384

The TicksToTimeHelper class use different return values depending on if 
you want to convert to seconds or milliseconds.

class TicksToTimeHelper : public AllStatic {
  public:
   enum Unit {
     SECONDS = 1,
     MILLISECONDS = 1000
   };
   static double seconds(const Tickspan& span);
   static jlong milliseconds(const Tickspan& span);
};

No one is using the conversion to milliseconds() but because it returns 
a jlong it loses precision.

Making milliseconds() return a double allows for coming uses to get 
millisecond values with higher precision.

Thanks,
Bengt


More information about the serviceability-dev mailing list