decodetime(time,hour,min,sec,msec)把当前时间分解成小时,分,秒,毫秒!

解决方案 »

  1.   

    用 GETTICKCOUNT;
    比如
       VAR  ISSTAR,ISEND:INTEGER;
        ISSTAR:=GETTICKCOUNT;
        //DOSOMETHING
        ISEND:=GETTICKCOUNT;
        SHOWMESSAGE(FLOATTOSTR(ISEND-ISSTAR));
      

  2.   

    var
      Present1,Present1: TDateTime;
      Hour1, Min1, Sec1, MSec1,Hour2, Min2, Sec2, MSec2: Word;
      ToTal:Integer;
     begin
      DecodeTime(Present1, Hour1, Min1, Sec1, MSec1);
      DecodeTime(Present2, Hour2, Min2, Sec2, MSec2);
      ToTal:=(Hour2-Hour1)*60*60*1000+(Min2-Min1)*60*1000
             +(Sec2-Sec1)*1000+MSec2-MSec1;
      

  3.   

    to 楼上
    既然你是用integer类型又何必用floattostr转换呢
    最好还是用Longword类型再用inttostr吧
      

  4.   

    用GetTickCount取得当前时间(毫秒)
    等操作完之后再取GetTickCount,并减去前面的GetTickCount,就是两次操作之间的时间差,毫秒级的时间差。
      

  5.   

    formmerTick,latterTick,TimePassed:DWord;   //或者是Longword,等价的。formmerTick:=GetTickCount;
      ……
    //你的其它代码
    latterTick:=GetTickCount;
    TimePassed:=latterTick-formmerTick;
    Label1.Caption:=IntToStr(TimePassed);注解:
    The GetTickCount function retrieves the number of milliseconds that have elapsed since Windows was started. DWORD GetTickCount(VOID)
     ParametersThis function has no parameters. Return ValuesIf the function succeeds, the return value is the number of milliseconds that have elapsed since Windows was started. ResThe elapsed time is stored as a DWORD value. Therefore, the time will wrap around to zero if Windows is run continuously for 49.7 days. 
      

  6.   

    qiubolecn(qiubole):
    一时写快,是INTTTOSTR,呵呵