Powerlevel9k / powerlevel9k

Powerlevel9k was a tool for building a beautiful and highly functional CLI, customized for you. P9k had a substantial impact on CLI UX, and its legacy is now continued by P10k.
https://github.com/romkatv/powerlevel10k
MIT License
13.46k stars 949 forks source link

command_execution_time shows wrong time when the duration is more than 24h #1308

Open Hazegard opened 5 years ago

Hazegard commented 5 years ago

Describe Your Issue

What is happening? When the command lasts more than 24 hours, the command_duration_time compute the output with a 24 hour modulus Most issues are best explained with a screenshot. Please share one if you can! image

Have you tried to debug or fix it?

Have you tinkered with your settings, and what happened when you did? Did you find a bit of code that you think might be the culprit? Let us know what you've done so far!

I think the issue is here: https://github.com/bhilburn/powerlevel9k/blob/next/segments/command_execution_time/command_execution_time.p9k#L43

$ TZ=GMT; strftime '%H:%M:%S' $(( int(rint(90000)) ))
01:00:00
$ TZ=GMT; strftime '%H:%M:%S' $(( int(rint(180000)) ))
02:00:00

A fix could be to test if the command lasts more than 24 hours (86400s), and display the ellapsed days (for example with %j , or to keep the output in hours but i'm not sure how to do this with strftime)

Environment Information

This information will help us understand your configuration.