不過這有現成的函數: TimeStampToMSecs、MSecsToTimeStamp.
{TimeStampToMSecs、MSecsToTimeStamp 示例:}
var
T: TDateTime;
TS: TTimeStamp;
ms: Comp; {這是 TimeStampToMSecs 返回的類型}
begin
T := EncodeDateTime(2009, 5, 22, 11, 22, 33, 999);
TS := DateTimeToTimeStamp(T);
ms := TimeStampToMSecs(TS);
ShowMessage(FloatToStr(ms)); //63378674553999
TS := MSecsToTimeStamp(ms);
T := TimeStampToDateTime(TS);
ShowMessage(FormatDateTime('yyyy-m-d h:m:s:z', T)); //2009-5-22 11:22:33:999
end;
另外: GetTickCount 函數可獲取從開機時間到當前時間的毫秒數, 結合上面, 可以算出開機