"Little time displaying bug?"

cherokee
cherokee New Altair Community Member
edited November 5 in Community Q&A
Hi!

Today I read following log message:
Jul 11, 2009 2:49:46 PM: [NOTE] Process finished successfully after 2 min 60 s
It's a bit strange with 60s. Is this a bug or a feature I don't understand?

Best regards,
Michael

Answers

  • steffen
    steffen New Altair Community Member
    Hello

    ... and I thought I was picky  ;D ...

    After a short laugh I gave myself 5 minutes to check where this error comes from. The function doing the formatting com.rapidminer.Tools#format(long) seems to be okay, so I guess you have found on the rare occasions where the storage of numbers with a limited number of bits shows its ugly face. I wouldnt wonder if the milliseconds have represented a value 59,9999999999999999999999999999999.... (sorry, no bits left) seconds.

    kind regards,

    Steffen
  • cherokee
    cherokee New Altair Community Member
    Ok, now that I know that I'm picky  ;)

    Let's get started. Now as I know where to search for the formating function (com.rapidminer.Tools.TimeFormat#format(long) I've looked it up myself. Your solution is right but there is a bug. ;D

    Formatting 60000 would result in "60s". In line 108 your checking if your ms-value is bigger than the desired "unit multiplicator", but 60s is exactly one minute even if it's not bitter than one minute. You should check for bigger or equal.

    By the way: You are using Time Format only with the default constructor. This way you have secondsFormat = new DecimalFormat("0"). This uses half_even rounding as default (http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html). So even 59500 ms would be rendered as "60s".

    *pickymodeoff*

    Best regards,
    Michael

  • fischer
    fischer New Altair Community Member
    Hi,

    you are right, this was a really silly bug :-) We spotted it recently and it has already been fixed.

    Cheers,
    Simon