Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Update ReportNGUtils.java #64

Closed
wants to merge 1 commit into from
Closed

Conversation

corangec
Copy link

  • added true time duration tracking for reportNG.
  • auto format time duration and convert secs to hr, min and sec

- added true time duration tracking for reportNG.
- auto format time duration and convert secs to hr, min and sec
@s2005lg
Copy link

s2005lg commented Oct 11, 2015

I have forked this project. If the author is not responded, please follow below project.

https://github.com/SouWilliams/reportng

I will do my best to update reportNG as much as i can

@@ -87,8 +65,25 @@ public String formatDuration(long startMillis, long endMillis)

public String formatDuration(long elapsed)
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend using the java TimeUnit package for this (java.util.concurrent.TimeUnit)

private static String formatInterval(final long l) {
   final long hr = TimeUnit.MILLISECONDS.toHours(l);
   final long min = TimeUnit.MILLISECONDS.toMinutes(l - TimeUnit.HOURS.toMillis(hr));
   final long sec = TimeUnit.MILLISECONDS.toSeconds(l - TimeUnit.HOURS.toMillis(hr) - TimeUnit.MINUTES.toMillis(min));
   final long ms = TimeUnit.MILLISECONDS.toMillis(l - TimeUnit.HOURS.toMillis(hr) - TimeUnit.MINUTES.toMillis(min) - TimeUnit.SECONDS.toMillis(sec));
   return String.format("%02d:%02d:%02d.%03d", hr, min, sec, ms);
}

@dwdyer dwdyer closed this Dec 3, 2015
@dwdyer
Copy link
Owner

dwdyer commented Dec 3, 2015

I am no longer maintaining this project. If you need to continue using it your best option is to maintain your own fork.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants