[Lazarus] Obtaining uptime
Richard Mace
richard.mace at gmail.com
Wed Aug 6 07:49:47 CEST 2014
Hi,
Does anyone know why the following code returns the correct days uptime in
XP, but doesn't in Windows 8? (not tested in anything other)
Also, is it close to working correctly in Linux as well?
Thanks in advance
Richard
function TfrmMain.GetDaysUptime: integer;
var
TickCount: variant;
mySeconds: variant;
dys,hrs,min,sec : variant;
begin
TickCount := LclIntf.GetTickCount;
mySeconds := TickCount Div 1000;
hrs := (mySeconds Div 60) Div 60;
mySeconds := mySeconds - (hrs * 60 * 60);
min := mySeconds Div 60;
mySeconds := mySeconds - (min * 60);
sec := mySeconds;
if hrs >= 24 then
dys := hrs Div 24
else
dys := 0;
Result := dys;
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140806/54045e5c/attachment-0002.html>
More information about the Lazarus
mailing list