oh-my-fish / theme-budspencer

A theme for nerds, makes fish even more powerful. It's equipped with a hell of a lot of nice functions and key bindings to speed up your workflow.
MIT License
106 stars 42 forks source link

Duration timer doesn't show correct number of days #62

Closed ironsigma closed 4 years ago

ironsigma commented 4 years ago

Seems you have a typo in your duration calculation, for days you have 68400 instead of 86400. Also noticed you are moding multiple times, you can just do the final mod. Finally you can use fish's math built in instead of expr

       set -l cmd_duration (math -s0 $CMD_DURATION / 1000)
        set seconds (math -s0 $cmd_duration % 60)'s'
        if [ $cmd_duration -ge 60 ]
            set minutes (math -s0 $cmd_duration % 3600 / 60)'m'
            if [ $cmd_duration -ge 3600 ]
                set hours (math -s0 $cmd_duration % 86400 / 3600)'h'
                if [ $cmd_duration -ge 86400 ]
                    set days (math -s0 $cmd_duration / 86400)'d'
                  end
              end
          end
clayauld commented 4 years ago

Thanks for the input. Would you mind making a PR with your proposed changes? I can test and merge them to correct this issue.