Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to get Windows uptime Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
12-Oct-02
Category
System
Language
Delphi 3.x
Views
51
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Fernando Silva 

How to get Windows uptime?

Answer:

Use the following function:

1   function UpTime: string;
2   const
3     ticksperday: integer = 1000 * 60 * 60 * 24;
4     ticksperhour: integer = 1000 * 60 * 60;
5     ticksperminute: integer = 1000 * 60;
6     tickspersecond: integer = 1000;
7   
8   var
9     t: longword;
10    d, h, m, s: integer;
11  
12  begin
13    t := GetTickCount;
14  
15    d := t div ticksperday;
16    dec(t, d * ticksperday);
17  
18    h := t div ticksperhour;
19    dec(t, h * ticksperhour);
20  
21    m := t div ticksperminute;
22    dec(t, m * ticksperminute);
23  
24    s := t div tickspersecond;
25  
26    Result := 'Uptime: ' + IntToStr(d) + ' Days ' + IntToStr(h) + ' Hours ' + 
27  IntToStr(m)
28      + ' Minutes ' + IntToStr(s) + ' Seconds';
29  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC