decodetime(time,hour,min,sec,msec)把当前时间分解成小时,分,秒,毫秒!
解决方案 »
- 如何隐藏cxGrid的表头倒三角
- 超简单,可我就是不知道,送份
- Delphi8中编译的EXE文件在其他没有安装Delphi的机器上运行出错
- 用Delphi开发的ActiveForm,浏览器中的Messenger,请各位都来看看!
- 如何把adotable1.recordcount的数值引用到setlength()中去?
- sql server数据如何导成excel数据?
- 100分低手问题:请问如何使TSaveDialog组件能自动给用户指定的文件名后加扩展名?(内详)
- 关于使用tupdateqlr的问题?please help me !
- 如何在delphi中實現利用excel做報表的功能
- delphi10可以在win8系统里安装么?
- 文字特效显示!!!!!!!!!
- NMPOP3控件收到邮件后邮件主题为何是乱码
比如
VAR ISSTAR,ISEND:INTEGER;
ISSTAR:=GETTICKCOUNT;
//DOSOMETHING
ISEND:=GETTICKCOUNT;
SHOWMESSAGE(FLOATTOSTR(ISEND-ISSTAR));
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;
既然你是用integer类型又何必用floattostr转换呢
最好还是用Longword类型再用inttostr吧
等操作完之后再取GetTickCount,并减去前面的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.
一时写快,是INTTTOSTR,呵呵