اینم یک تابع کار آمد واسه محاسبه ی زمان کارکرد سیستم

کد:

کد:
{ÒãÇä ˜ÇјÑÏ ÓíÓÊã }
 

function WindowsUpTime : string ;
  function MSecToTime(mSec: Integer): string;
  const
    secondTicks = 1000;
    minuteTicks = 1000 * 60;
    hourTicks = 1000 * 60 * 60;
    dayTicks = 1000 * 60 * 60 * 24;
  var
     D, H, M, S: string;
     ZD, ZH, ZM, ZS: Integer;
  begin
     ZD := mSec div dayTicks;
     Dec(mSec, ZD * dayTicks) ;

     ZH := mSec div hourTicks;
      Dec(mSec, ZH * hourTicks) ;

      ZM := mSec div minuteTicks;
     Dec(mSec, ZM * minuteTicks) ;
     
     ZS := mSec div secondTicks;
     Dec(mSec, Zs * secondTicks) ;

     D := IntToStr(ZD) ;
     H := IntToStr(ZH) ;
     M := IntToStr(ZM) ;
     S := IntToStr(ZS) ;
     Result := D + "." + H + ":" + M + ":" + S;
  end;
begin
  result := MSecToTime(GetTickCount) ;


  
end;