mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Consistently use FormatTimeNumber() also for formatting server uptime. Leave out the day portion if zero.
This commit is contained in:
@ -2036,13 +2036,18 @@ end;
|
||||
}
|
||||
function FormatTimeNumber( Seconds: Cardinal ): String;
|
||||
var
|
||||
h, m, s : Integer;
|
||||
d, h, m, s : Integer;
|
||||
begin
|
||||
s := Seconds mod (60*60*24);
|
||||
s := Seconds;
|
||||
d := s div (60*60*24);
|
||||
s := s mod (60*60*24);
|
||||
h := s div (60*60);
|
||||
s := s mod (60*60);
|
||||
m := s div 60;
|
||||
s := s mod 60;
|
||||
if d > 0 then
|
||||
Result := Format('%d days, %.2d:%.2d:%.2d', [d, h, m, s])
|
||||
else
|
||||
Result := Format('%.2d:%.2d:%.2d', [h, m, s]);
|
||||
end;
|
||||
|
||||
|
@ -4277,20 +4277,11 @@ end;
|
||||
|
||||
|
||||
procedure TMainForm.TimerHostUptimeTimer(Sender: TObject);
|
||||
var
|
||||
ServerUptime, days, hours, minutes, seconds : Integer;
|
||||
begin
|
||||
// Host-Uptime
|
||||
if Assigned(Connection) then begin
|
||||
ServerUptime := Connection.ServerUptime;
|
||||
days:= ServerUptime div (60*60*24);
|
||||
seconds := ServerUptime mod (60*60*24);
|
||||
hours := seconds div (60*60);
|
||||
seconds := seconds mod (60*60);
|
||||
minutes := seconds div 60;
|
||||
seconds := seconds mod 60;
|
||||
showstatus(Format('Uptime: %d days, %.2d:%.2d:%.2d', [days,hours,minutes,seconds]), 4);
|
||||
end else
|
||||
// Display server uptime
|
||||
if Assigned(Connection) then
|
||||
showstatus('Uptime: '+FormatTimeNumber(Connection.ServerUptime), 4)
|
||||
else
|
||||
showstatus('', 4);
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user