-
Notifications
You must be signed in to change notification settings - Fork 160
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
Add millis to format_duration #259
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.0 seconds
, 1.0 seconds
and friends look weird. So does 0.500 seconds
. Can we have 1.2 seconds
and 200 milliseconds
at the same time?
Is a build in milliseconds realistic? The builds I do will always take well over 1 second. |
Subsecond builds are not possible most of the time, however knowing where latency comes from is important. The better (unless annoying) we show it the more users would care about optimizing their configurations. I for one defintely pay attention to duration output of my build tooling and try to optimize remaining tail latency |
I can agree to always showing 3 digits, would that be fine with you? Like this:
|
Nope, sorry. |
You'll never see exactly 1.000, you know that. 1 digit after |
Yes, |
Maybe I didn't describe idea well enough, sorry about that. Idea is that in relatively short timings (< 60 seconds) milliseconds matter, of course it doesn't matter when we're talking minutes. I guess a rule of thumb could be to show previous precision of the major time unit. Like this:
|
I can get behind these rules. Is it covered by the current change or you’ll need adjustments? |
To clarify, this PR doesn't follow that rule of thumb ^, I just came up with it to have better description of what was the motivation behind the change |
---- RACE CONDITION DETECTED ---- ok, now that we have agreement I'll adjust PR |
Done! Also, had to update Rust because #[stable(feature = "duration_as_u128", since = "1.33.0")]
#[inline]
pub const fn as_millis(&self) -> u128 { |
PR description updated accordingly. |
@ming13 can you ptal? |
cc @sboishtyan |
and @Tagakov |
@artem-zinnatullin, can we use a magical Rust package for this? I hope Rust is not that bad that there is no time formatting tool around. |
We prob can, but really the code is so tiny that it's not a big deal I think |
But if someone finds such a package, I'm def down to take a look at it |
@artem-zinnatullin, |
Closes #258.
Shows precision of the unit previous to the major time unit.
Like this:
Includes Rust update to use
as_millis
, release notes: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1341-2019-04-25Example of output (combined with #256):