Skip to content

switch from humantime to jiff #32

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

Merged
merged 3 commits into from
Mar 11, 2025
Merged

Conversation

BurntSushi
Copy link
Contributor

This PR bumps to jiff 0.2 and removes humantime in favor of jiff.

Back when I first contributed the change to move to Jiff
in #31, Jiff didn't have a way of formatting durations
like humantime does. But Jiff does support that
now
.

One part I'm a little unsure about here is that prodash was still
trying to emit times even when local-time wasn't enabled, and it
was using humantime to do this. But now that Jiff is used for both
things, it probably doesn't make sense to have this fallback. (I think
it's also somewhat suspicious, since printing UTC time as if it were
local time is likely confusing.) In any case, I left it as it was,
except with using Jiff.

I tried running tests locally, but one of the tui rendering tests just
hung indefinitely for me.

Since prodash switched over to Jiff, Jiff has grown support for the
"friendly" duration format. It is meant to be a replacement for
`humantime` formatting of durations.
@Byron
Copy link
Member

Byron commented Mar 11, 2025

Thanks so much for your continued and timely support, it's much appreciated! That's exactly what I was looking for when getting this PR ready for merging, so once again, perfect timing :D.

With these out of my system, make tests worked for me, and so did the monstrous cargo run --example dashboard --features="render-tui render-tui-crossterm render-line render-line-crossterm signal-hook render-line-autoconfigure progress-tree local-time" --.

I don't know if it was always so precise, but think that such details can be tackled at a time when displaying durations in the terminal becomes important.

Screenshot 2025-03-11 at 15 06 26

Thanks again!

@Byron Byron merged commit eaf1c26 into GitoxideLabs:main Mar 11, 2025
2 checks passed
@Byron
Copy link
Member

Byron commented Mar 11, 2025

PS: I really like that the code became so much simpler thanks to the change!

@BurntSushi
Copy link
Contributor Author

Nice! And yeah, from my read of it, humantime should have also shown similarly precise durations.

If and when you do want to tweak it, Jiff has a lot of options for rounding durations and controlling the largest/smallest units. Happy to field questions there!

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

Successfully merging this pull request may close these issues.

2 participants