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

_format_seconds should accept a max-precision argument #8

Open
dimo414 opened this issue Feb 27, 2020 · 0 comments
Open

_format_seconds should accept a max-precision argument #8

dimo414 opened this issue Feb 27, 2020 · 0 comments

Comments

@dimo414
Copy link
Owner

dimo414 commented Feb 27, 2020

$ _format_seconds "$(sed 's/\..*//' /proc/uptime)"
8d 16h 49m 37s

This might be more verbose than callers always want, it would be nice to permit them to cap the precision, e.g.

$ _format_seconds "$(sed 's/\..*//' /proc/uptime)" 2 # 2 means "no more than two units"
8d 16h

$ _format_seconds 100 3 # may still print less if small enough
1m 40s
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

1 participant