如何取得系统毫秒级时间,以前好象有人提过?(100分)

  • 主题发起人 主题发起人 gxetdc
  • 开始时间 开始时间
G

gxetdc

Unregistered / Unconfirmed
GUEST, unregistred user!
如何取得系统毫秒级时间,以前好象有人提过?
 
GetTickCount取得系统开始以来经过的毫秒
win32api GetSystemTime 可以取得当前的时间,最小到毫秒
 
TimeGetTime or getTickCount
 
DeCodeTime, EnCodeTime中的最后一个参数就是毫秒
 
procedure TForm1.Button1Click(Sender: TObject);

var
Present: TDateTime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
Present:= Now;
DecodeDate(Present, Year, Month, Day);
Label1.Caption := 'Today is Day ' + IntToStr(Day) + ' of Month '
+ IntToStr(Month) + ' of Year ' + IntToStr(Year);
DecodeTime(Present, Hour, Min, Sec, MSec);
Label2.Caption := 'The time is Minute ' + IntToStr(Min) + ' of Hour '
+ IntToStr(Hour);
end;
 
uses DateUtils (*等等*);
......

procedure TForm1.Button1Click(Sender: TObject);
var iYear,iMon,iDay,iHour,iMin,iSec,iAMilliSecond:word ;
begin
DecodeDateTime(Now(),iYear,iMon,iDay,iHour,iMin,iSec,iAMilliSecond);
showmessage(InttoStr(iAMilliSecond));//显示毫秒数
end;
 
多人接受答案了。
 
后退
顶部