• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 380
  • Last Modified:

Uptime

Hi

How can I read and interpret system uptime under Windows XP ??
0
szafran
Asked:
szafran
  • 3
  • 3
1 Solution
 
heretoreadCommented:
function GetUpTime:String;
var
  Sec, Min, Hour, Day:Cardinal;
begin
  Sec:= GetTickCount div 1000;
  Min:= Sec div 60;
  Hour:= Min div 60;
  Day:= Hour div 24;
  Result:= IntToStr(Day)+':Days, '+IntToStr(Hour mod 24)+':Hours, '+IntToStr(Min mod 60)+':Minutes, '+IntToStr(Sec mod 60)+':Seconds';
end;
0
 
szafranAuthor Commented:
works great
thanks
0
 
szafranAuthor Commented:
@heretoread
is there an easy way to add Years to this function ??
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
heretoreadCommented:
There would be no point, as GetTickCount returns a DWORD and only works upto 49.7 days.
0
 
szafranAuthor Commented:
only 49 days ??
i've heard that it can be longer :/

and there is a point because my proggy not only shows current uptime but laso adds it to a summary uptime.
0
 
heretoreadCommented:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/gettickcount.asp

There is GetTickCount64(); but thats Vista only.

To get years just take all the days and divide it by 365.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now