Skip to content

Revisit delta time formats #42

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

Open
hollasch opened this issue Oct 26, 2018 · 1 comment
Open

Revisit delta time formats #42

hollasch opened this issue Oct 26, 2018 · 1 comment

Comments

@hollasch
Copy link
Owner

hollasch commented Oct 26, 2018

timeprint should be able to track the next greater unit automatically, left to right. Possibly try out a new experimental delta token that does this automatically. Try new delta symbol -. This would yield the following syntax:

                   %-['kd][0]<U>[.[#]]
                      -v-  v  v  --v-
Numeric Format --------'   |  |    |
Optional leading zeros ----'  |    |
Units ------------------------'    |
Decimal Precision -----------------'

How to handle the case where the next greater unit was equal or smaller than the current? Consider suppressing the interpretation of the current code (printing it literally), or insert an error indicator.

As an example, this:

timeprint --now --time 20181029T160000 %_Dd %_d0H:%_h0M:%_m0S

becomes this:

timeprint --now --time 20181029T160000 %-Dd %-0H:%-0M:%-0S

More intuitive and less error-prone. An sketch of an erroneous format string:

timeprint --now --time 20181029T160000 %-Dd %-0H:%-0D:%-0S
15d 23:<ERROR: %-0D>:2718
@hollasch hollasch self-assigned this Oct 26, 2018
@hollasch
Copy link
Owner Author

Alternative: lowercase characters denote context-aware modulo, uppercase versions are always full values. In addition, if a greater or same unit is specified after a lesser or same unit, then just reset the prior modulo to none.

@hollasch hollasch removed their assignment Jul 11, 2019
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