惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
S
SegmentFault 最新的问题
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
F
Fortinet All Blogs
TaoSecurity Blog
TaoSecurity Blog
D
Docker
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
宝玉的分享
宝玉的分享
腾讯CDC
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
T
The Exploit Database - CXSecurity.com
T
The Blog of Author Tim Ferriss
V
V2EX
S
Securelist
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
Y
Y Combinator Blog
P
Proofpoint News Feed
T
Tor Project blog
AWS News Blog
AWS News Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
博客园 - 聂微东
T
Threat Research - Cisco Blogs
B
Blog
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
N
News and Events Feed by Topic
博客园 - 司徒正美
H
Help Net Security
C
Cisco Blogs
C
Check Point Blog
S
Secure Thoughts

博客园 - 邵印中

DBF数据库资料 电脑不能开机之U盘问题 电脑自动关机之CPU风扇烧坏 广州小灵通呼叫转移 - 邵印中 - 博客园 数字电视,方便了谁 解决连接SQL Server 2000的TCP/IP错误的Bug 商品EAN13条码的生成 商品条码的生成 关于错误“Cannot connect to the Citrix MetaFrame server.Can't assign requested address”的解决方法 电脑死机之CPU温度过高 winrar 8 注册方法 "加载类型库/dll时出错" 的解决方法 删除子窗体中的控件中的某些属性时出现"Selection contains a component introduced in an ancestor form which cannot be deleted."错误的解决方法 SC命令配置服务 SQL 2005如何更改服务器身份验证模式 There is no Citrix MetaFrame server configured on the specified address错误的解决方法 ASP.NET AJAX,WCF,ADO.NET Entity 开发实例 Citrix 客户端登录出现wfshell.exe - 应用程序错误的解决方法 WCF 学习资源
DELPHI高精度计时方法,取毫秒级时间精度
邵印中 · 2009-11-29 · via 博客园 - 邵印中

//取毫秒级时间精度(方法一):
  var
  t1,t2:int64;
  r1:int64;
  begin
  t1:=GetTickCount;//获取开始计数 WINDOWS API
  sleep(1000);{do...}//执行要计时的代码
  t2:=GetTickCount;//获取结束计数值
  r1:=t2-t1;//取得计时时间,单位毫秒(ms)
  showmessage(inttostr(r1));
  end;

//取毫秒级时间精度(方法二):
  //use DateUtils;//引用DateUtils单位
  var
  t1,t2:tdatetime;
  r1:int64;
  begin
  t1:=now();//获取开始计时时间
  sleep(1000);{do...}//执行要计时的代码
  t2:=now();//获取结束计时时间
  r1:=SecondsBetween(t2,t1);//取得计时时间,单位秒(s)
  r1:=MilliSecondsBetween(t2,t1);//取得计时时间,单位毫秒(ms)
  showmessage(inttostr(r1));
  end;

  //注:以上两种方式经本人测试好像只能产生0.01秒的计时精度

  //取系统级时间精度:
  var
  c1:int64;
  t1,t2:int64;
  r1:double;
  begin
  QueryPerformanceFrequency(c1);//WINDOWS API 返回计数频率(Intel86:1193180)(获得系统的高性能频率计数器在一毫秒内的震动次数)
  QueryPerformanceCounter(t1);//WINDOWS API 获取开始计数值
  sleep(1000);{do...}//执行要计时的代码
  QueryPerformanceCounter(t2);//获取结束计数值
  r1:=(t2-t1)/c1;//取得计时时间,单位秒(s)
  r1:=(t2-t1)/c1*1000;//取得计时时间,单位毫秒(ms)
  r1:=(t2-t1)/c1*1000000;//取得计时时间,单位微秒
  showmessage(floattostr(r1));
  end;