I'm not sure if this is relevant here (since I didn't test anything), but shouldn't be the calculation of hours like this?:
> h := r mod 24; r := r div 24;
ZOPPO
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
Title | # Comments | Views | Activity |
---|---|---|---|
can't find the executable in Simulator | 1 | 80 | |
Performance of SQL statement | 37 | 100 | |
IdTCPClient and IdTCPServer exchanging data on desktops and not Android | 11 | 95 | |
Moving (cutting/pasting) controls in a TTabbedNotebook... | 7 | 27 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
18 Experts available now in Live!