Skip to content

Show compound units in elapsed time display.#87

Open
wtn wants to merge 1 commit into
socketry:mainfrom
wtn:align
Open

Show compound units in elapsed time display.#87
wtn wants to merge 1 commit into
socketry:mainfrom
wtn:align

Conversation

@wtn

@wtn wtn commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

When logging from a long-running script, I'll get many messages in a row that all show 1h. It would be nice to have a minute column, so I can see elapsed time between events at a glance.

So following up on #84, I suggest to show compound units in the elapsed time display. Instead of collapsing to a single coarse unit, each range past 60 seconds keeps sub-unit resolution and aligns vertically in a fixed-width format.

Examples

Existing

 0.84s     debug: Example [ec=0xe60] [pid=80719]
59.99s     debug: Example [ec=0xfb4] [pid=80719]
    2m     debug: Example [ec=0x1090] [pid=80719]
   23m     debug: Example [ec=0x10cc] [pid=80719]
    1h     debug: Example [ec=0x1108] [pid=80719]
    9h     debug: Example [ec=0x111c] [pid=80719]
    2d     debug: Example [ec=0x1130] [pid=80719]

Proposed

 0.84s     debug: Example [ec=0xe60] [pid=80719]
59.99s     debug: Example [ec=0xfb4] [pid=80719]
 2m03s     debug: Example [ec=0x1090] [pid=80719]
23m47s     debug: Example [ec=0x10cc] [pid=80719]
 1h05m     debug: Example [ec=0x1108] [pid=80719]
 9h48m     debug: Example [ec=0x111c] [pid=80719]
 2d05h     debug: Example [ec=0x1130] [pid=80719]

The unit divider (., m, h, d) stays in the third column, so the field still reads cleanly down the column. Past 99 days it falls back to bare days (100d, 1000d) to stay within the six-column width.

Clock.formatted_duration also feeds the progress summary sentence, which now reads completed in 2m05s, 1m02s remaining instead of 2m, 1m. (If this change is not desired, the implementations can be separated.)

Types of Changes

  • New feature.

Contribution

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.

1 participant