Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
function GetPerformanceCounterTick: Int64;
var PCount: Int64;
begin;
if QueryPerformanceCounter(PCount) then Result := PCount
else raise exception.create('QueryPerformanceCounter Error');
end;
function GetTimerFrequency: Int64;
var Frequency: Int64;
begin
if QueryPerformanceFrequency(Frequency) then Result := Frequency
else raise exception.create('QueryPerformanceFrequency Error');
end;
function SystemUptime:string;
var f, t : int64;
r, d, h, m, s : word;
begin;
f := GetTimerFrequency;
t := GetPerformanceCounterTick;
r := t div f; // in seconds
s := r mod 60; r := r div 60;
m := r mod 60; r := r div 60;
h := r mod 60; r := r div 24;
d := r;
if d >0 then result := Format('%3d Days %2d Hours %2d Minutes %2d Seconds', [d, h, m, s])
else if h > 0 then result := Format('%2d Hours %2d Minutes %2d Seconds', [h, m, s])
else if m > 0 then result := Format('%2d Minutes %2d Seconds', [m, s])
else result := Format('%2d Seconds', [s])
end;
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.