Project

General

Profile

« Previous | Next » 

Revision f2f86310

Added by Stilez y almost 9 years ago

Simplify convert_seconds_to_hms() and show days for large numbers of hours

1) Function can be simplified and all "if" statements removed, using intdiv (or casting result as int for PHP < 7) and % for calcs and sprintf for padding.
2) Input validity check before trying to convert format
3) If time represented is large (eg uptime might be several months) then hours becomes unhelpful, it's clearer to show "4921:02:06" as "205d 01:02:06". (Leading "days" value not shown unless >=1 for simplicity)
(cherry picked from commit 0bde6d1057ed39c8ef650a5a505cf9ae5eb7199e)

  • added
  • modified
  • copied
  • renamed
  • deleted