1 2 //This procedure tells how long your PC have been running.3 //NOTE: After 49.7 days windows starts over to zero in keeping track4 //on how long its been running.5 6 procedure TForm1.Button1Click(Sender: TObject);
7 const8 cDay= 86400000;
9 cHour=3600000;
10 cMin = 60000;
11 cSec = 1000;
12 var13 14 iTick:dword;
15 idays,iHour,iMin,iSec,iMil: integer;
16 sHold:string;
17 18 begin19 iTick:=gettickCount;
20 idays:= iTick div cDay; //calculates days21 iHour:= (iTick mod cDay) div cHour; //calculates Hours22 iMin:= ((iTick mod cDay) mod cHour) div cMin; //calculates minutes23 iSec:=(((iTick mod cDay) mod cHour) mod cMin) div cSec; //calculates Seconds24 iMil:=(((iTick mod cDay) mod cHour) mod cMin) mod cSec; //calculates Milliseconds25 sHold:= 'This PC has been running for '+intTostr(iDays)+' Days, ';
26 sHold:=sHold+IntTostr(iHour)+' Hours, ';
27 sHold:=sHold+IntTostr(iMin)+' Minutes, ';
28 sHold:=sHold+IntTostr(iSec)+' Seconds, ';
29 sHold:=sHold+IntTostr(iMil)+' Mil Sec. ';
30 31 showmessage(sHold);
32 33 end;