powerlevel9k icon indicating copy to clipboard operation
powerlevel9k copied to clipboard

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

Open Hazegard opened this issue 6 years ago • 0 comments

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.

  • What version of ZSH are you using? You can use zsh --version to see this. zsh 5.3.1

  • Do you use a ZSH framework (e.g., Oh-My-ZSH, Antigen)? Oh-My-ZSH

  • How did you install P9k (cloning the repo, by tarball, a package from your OS, etc.,)? Cloning the master branch

  • What version of P9k are you using? 6.7

  • Which terminal emulator do you use? Alacritty

Hazegard avatar Jun 13 '19 11:06 Hazegard