Could we get a new option for exec_time that allows a more exact execution time output?
e.g. 2.34s instead of 2s
Would allow this to be more useful for basic benchmarking.
Since today it can show 1d 3h 24m 33s we could add 34 ms to it.
Not sure yet if I like this idea, but here it goes: since milliseconds matter only on tiny time intervals, maybe instead of adding another configuration for this, show ms only to those people who configured SPACESHIP_EXEC_TIME_ELAPSED=0?
Hey @AlecRust, Good suggestion. But I'm afraid this would require major changes to exec_time section with chances of breaking section for many users.
Now let me explain why, spaceship_exec_time_precmd_hook considers time in seconds.
To support ms we would be required to pass time in milliseconds. Which unfortunately date don't have flag for milliseconds. We would be required to convert nanoseconds (date +%s%3N). But macOS doesn't support any more precision than seconds.
Even if we tackle these problems and implement this, I'm not in favor of displaying ms with every prompt. In addition to @maximbaz suggestion, We could add an option like SPACESHIP_EXEC_TIME_MS_SHOW which could be disabled by default.
I don't like the idea of adding a new option. Moreover, I'd like to postpone adding new options until we have some test cases. More options → harder to test.
Right now exec_time work fine. Having ms is the matter of taste. I like this idea, but it takes too much to have it implemented on every supported platform. That isn't a critical feature. Our primary goals right now:
Most helpful comment
Hey @AlecRust, Good suggestion. But I'm afraid this would require major changes to
exec_timesection with chances of breaking section for many users.Now let me explain why,
spaceship_exec_time_precmd_hookconsiders time in seconds.https://github.com/denysdovhan/spaceship-prompt/blob/3bde13162fc8060ef4c47994b0cc3d27e4ebf000/lib/hooks.zsh#L20
To support
mswe would be required to pass time in milliseconds. Which unfortunatelydatedon't have flag for milliseconds. We would be required to convert nanoseconds (date +%s%3N). But macOS doesn't support any more precision than seconds.Even if we tackle these problems and implement this, I'm not in favor of displaying
mswith every prompt. In addition to @maximbaz suggestion, We could add an option likeSPACESHIP_EXEC_TIME_MS_SHOWwhich could be disabled by default.