String getElapsedFormatted(DateFormat _dateFormat, long _elapsedTime) {
        Date elapsedTime = new Date(_elapsedTime);

        DateFormat sdf = _dateFormat;
        if (_dateFormat == null) {
            sdf = new SimpleDateFormat("HH:mm:ss.SSS");
        }
        sdf.setTimeZone(TimeZone.getTimeZone("UTC")); // always use UTC so we get the correct time without timezone offset on it

        return sdf.format(elapsedTime);
    }
String getElapsedFormatted ( DateFormat _dateFormat , long _elapsedTime ) { Date elapsedTime = new Date ( _elapsedTime ) ; DateFormat sdf = _dateFormat ; if ( _dateFormat == null ) { sdf = new SimpleDateFormat ( "HH:mm:ss.SSS" ) ; } sdf . setTimeZone ( TimeZone . getTimeZone ( "UTC" ) ) ; return sdf . format ( elapsedTime ) ; }
Same as above, used for proper unit testing.
@param _dateFormat
@param _elapsedTime
@return formatted string