请问delphi中要计算程序运行的时间,怎么办?获取系统时间的函数是什么?
解决方案 »
- 关于DELPHI语法的一个问题
- TObject执行时资源占用的问题..
- 问一个简单问题吧,怎么样设置DBGrid的属性使DBGrid的选中状态显示一行呀
- 无法更新定位行,一些值可能已最后一次读取后已更改,......UP 有分,大侠请进..
- 如何在ListView的MouseDown事件中获取当前X,Y位置的Item?
- 关于传递信息的问题?
- 赐教!
- 谁有htmlreport的正式版控件?
- 在DATABASE事务处理中进行缓存数据提交时遇到的小问题
- query能不能对access数据库操作。
- 怎么用代码方式打开一个Access数据库呢?(ADO方式)
- 为什么动态库形式的Frame中不能放Memo,Tree等很多控件。up有分,欢迎讨论。
time()当前时间.
DescriptionGetTickCount is a Cardinal function used to retrieve the number of milliseconds since the computer was started.
GetTickCount is often used when calculating the response times for Indy components such as TIdEcho and TIdTime.
GetTickCount encapsulates the platform-specific calls necessary to provide a high resolution timer for fixed duration events. On the Windows platform, the function used is Windows.GetTickCount. On the Linux platform, GetTickCount uses the library function clock adjusted to thousandths of CLOCKS_PER_SECs.
time()当前时间.
GetSystemeTime
SetsystemTime
dosomething;
tick := GetTickCount - tick;
MessageBox(0, PChar(time use' + IntToStr(tick) + ' msec'), nil, 0);
DWORD GetTickCount(void);Parameters
This function has no parameters.
Return Values
The return value is the number of milliseconds that have elapsed since the system was started.Res
The elapsed time is stored as a DWORD value. Therefore, the time will wrap around to zero if the system is run continuously for 49.7 days.If you need a higher resolution timer, use a multimedia timer or a high-resolution timer.Windows NT/2000/XP: To obtain the time elapsed since the computer was started, retrieve the System Up Time counter in the performance data in the registry key HKEY_PERFORMANCE_DATA. The value returned is an 8-byte value. For more information, see Performance Monitoring.Example Code
The following example demonstrates how to handle timer wrap around.
DWORD dwStart = GetTickCount();// Stop if this has taken too long
if( GetTickCount() - dwStart >= TIMELIMIT )
Cancel();
Note that TIMELIMIT is the time interval of interest to the application.
接近毫秒单位