diff options
| author | Darkelarious <darkelarious@333networks.com> | 2021-09-09 14:02:36 +0200 |
|---|---|---|
| committer | Darkelarious <darkelarious@333networks.com> | 2021-09-09 14:02:36 +0200 |
| commit | abf0ef36b57c72b17d414673ecaadd74cf408134 (patch) | |
| tree | 9f56739bf25d209a7a795b28fe39ace05647b7ed /lib/MasterWebInterface/Handler/ServInfo.pm | |
| parent | 91729ec8ac5a8098cef2aa1c006aba88f6ef7eb3 (diff) | |
| download | WebInterface-Perl-abf0ef36b57c72b17d414673ecaadd74cf408134.tar.gz WebInterface-Perl-abf0ef36b57c72b17d414673ecaadd74cf408134.zip | |
style fix, readable gametypes
Diffstat (limited to 'lib/MasterWebInterface/Handler/ServInfo.pm')
| -rwxr-xr-x | lib/MasterWebInterface/Handler/ServInfo.pm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/MasterWebInterface/Handler/ServInfo.pm b/lib/MasterWebInterface/Handler/ServInfo.pm index 7dc5e55..032f929 100755 --- a/lib/MasterWebInterface/Handler/ServInfo.pm +++ b/lib/MasterWebInterface/Handler/ServInfo.pm @@ -176,12 +176,17 @@ sub show_server my @t = gmtime( time - ( $info->{dt_updated} // 0 ) ); my $diff; - $diff .= ($t[5]-70)*365 + $t[7] > 0 ? ( ($t[5]-70)*365 + $t[7])."d" : "" ; # years+days - $diff .= ($t[2] ? $t[2]."h" : ""); # hours - $diff .= ($t[1] ? $t[1]."m" : ""); # minutes - $diff .= ($t[0] ? sprintf "%02ds", $t[0] : ""); # seconds + $diff .= ($t[5]-70)*365 + $t[7] > 0 ? ( ($t[5]-70)*365 + $t[7])." days" : "" ; # years+days + # if no years/days, add hours/minutes/seconds to display + if ( ($t[5]-70)*365 + $t[7] <= 0 ) + { + $diff .= ($t[2] ? $t[2]."h" : ""); # hours + $diff .= ($t[1] ? $t[1]."m" : ""); # minutes + $diff .= ($t[0] ? sprintf "%02ds", $t[0] : ""); # seconds + } + # output and coloring if ( length $diff ) { span class => ( ($t[5]-70 or $t[7]) ? "r" : ($t[2] ? "o" : "g") ), $diff; |
