Skip to content

Bad output from TimeTool.millisecondsToTime(millis)  #27

@HelgeStenstrom

Description

@HelgeStenstrom

"1001, '.0' ", // Slightly over 1 second TODO: check if this is a bug,
"600001, '.0' " // Slightly over 10 minutes TODO: check if this is a bug

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)
    })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions