goxr3plus / java-stream-player

🌌Java Advanced Audio Controller Library (WAV, AU, AIFF, MP3, OGG VORBIS, FLAC, MONKEY's AUDIO and SPEEX audio formats )
GNU General Public License v3.0
147 stars 33 forks source link

Bad output from TimeTool.millisecondsToTime(millis) #27

Open HelgeStenstrom opened 5 years ago

HelgeStenstrom commented 5 years ago

https://github.com/goxr3plus/java-stream-player/blob/aea1720538cb972e6550a762d82345ce83a2db78/src/test/java/com/goxr3plus/streamplayer/tools/TimeToolTest.java#L45-L46

The method TimeTool.millisecondsToTime(millis) convert an integer, representing a number of milliseconds, to a string.

It's unclear from the JavaDoc of the method, what the intention was.

The JavaDoc has formatting problems; the /** before the word Returns should be removed.

The method contains commented-out code, which should be removed.

Given the name of the method, and the JavaDoc, I would expect a method that converts the milliseconds to hours:minutes:seconds (if time is over 60 minutes), or minutes:seconds otherwise.

This can be described as

    @CsvSource({
            "0, '00:00' ",
            "1, '00:00' ",
            "999, '00:01' ",
            "1001, '00:01' ",  // Slightly over 1 second
            "600001, '10:00 ", // Slightly over 10 minutes
            "3601001, '60:01 ", // One hour, one second (and a rounded off millisecond)
    })