Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FiniteDuration human representation #129

Open
Lasering opened this issue Aug 19, 2022 · 2 comments
Open

FiniteDuration human representation #129

Lasering opened this issue Aug 19, 2022 · 2 comments

Comments

@Lasering
Copy link

When debugging/inspecting code with timeouts/ellapsed times/etc using FiniteDuration seeing 2068493 seconds is not ergonomic, and in most cases unhelpful.

I suggest adding either of these things (or even everything):

  • A method that returns the duration per unit of time (Map[TimeUnit, Double]). For the example above it would be:

    Map(
      TimeUnit.DAYS -> 23,
      TimeUnit.HOURS -> 22,
      TimeUnit.MINUTES -> 34,
      TimeUnit.SECONDS -> 53,
    )
  • A method that returns a human readable string of the above. Keeping with the example it would return:
    23 days, 22 hours, 34 minutes, 53 seconds

  • An approximate human readable string: About 24 days. This method could have some sort of max allowed error function.

@benhutchison
Copy link

benhutchison commented Aug 19, 2022 via email

@morgen-peschke
Copy link

A method that returns a human readable string of the above.

This seems the most useful. The Map can already be done fairly easily, and the conversion to human-readable text isn't something you want to have to bother with whenever you need this.

The approximate string wouldn't really be helpful for one of the most common places I could see using this: failing test case output.

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

No branches or pull requests

3 participants