TStopwatch 高精度秒表 计时器

XETStopwatch是一款高精度秒表计时器,适用于监测操作执行时间。它利用系统依赖功能获取高分辨率计时器,提供StartNew和Create等方法初始化计时器,并支持开始、停止及重置等功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

XE TStopwatch 高精度秒表 计时器

Description

Provides a high-resolution stopwatch implementation.

Use TStopwatch to obtain access to high-resolution timers that can be used to monitor the time spent performing some operations.TStopwatch uses operating system-dependent functionality to gain access to high-resolution timers, if available; otherwise, the usual timers are used.

TStopwatch is not a class but still requires explicit initialization. Call theStartNew or Create method to initialize a TStopwatch value.

这样就不用放个timer控件了啊

 

struct DECLSPEC_DRECORD TStopwatch
{
private:
    static __int64 FFrequency;
    static bool FIsHighResolution;
    static double TickFrequency;
    __int64 FElapsed;
    bool FRunning;
    __int64 FStartTimeStamp;
    System::Timespan::TTimeSpan __fastcall GetElapsed(void);
    __int64 __fastcall GetElapsedDateTimeTicks(void);
    __int64 __fastcall GetElapsedMilliseconds(void);
    __int64 __fastcall GetElapsedTicks(void);
    static void __fastcall InitStopwatchType();
public:
    static TStopwatch __fastcall Create();
    static __int64 __fastcall GetTimeStamp();
    void __fastcall Reset(void);
    void __fastcall Start(void);
    static TStopwatch __fastcall StartNew();
    void __fastcall Stop(void);
    __property System::Timespan::TTimeSpan Elapsed = {read=GetElapsed};
    __property __int64 ElapsedMilliseconds = {read=GetElapsedMilliseconds};
    __property __int64 ElapsedTicks = {read=GetElapsedTicks};
    /* static */ __property __int64 Frequency = {read=FFrequency};
    /* static */ __property bool IsHighResolution = {read=FIsHighResolution};
    __property bool IsRunning = {read=FRunning};
};

http://delphi.about.com/od/windowsshellapi/a/delphi-high-performance-timer-tstopwatch.htm

d:\program files\embarcadero\studio\14.0\source\rtl\common\System.Diagnostics.pas

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值