CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
IBM Rational 系统开发最佳实践工具包 WebSphere MQ 最佳实践 TOP 15
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Windows专区 >  Windows NT/2000/XP/2003

关于记时函数

楼主bmwer()2003-08-04 00:59:31 在 Windows专区 / Windows NT/2000/XP/2003 提问

记得有一个可以精确记时的函数,例如记录一个线程运行时间,请问是什么?(不是GetTickCount()) 问题点数:0、回复次数:1Top

1 楼Clevor(扬子鳄)回复于 2003-08-04 07:56:30 得分 0

GetTickCount  
  The   GetTickCount   function   retrieves   the   number   of   milliseconds   that   have   elapsed   since   the   system   was   started.   It   is   limited   to   the   resolution   of   the   system   timer.   To   obtain   the   system   timer   resolution,   use   the   GetSystemTimeAdjustment   function.    
   
  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.    
   
  Remarks  
  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:   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  
  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();  
   
  Where   TIMELIMIT   is   the   time   interval   of   interest   to   the   application.    
   
  Requirements    
      Windows   NT/2000:   Requires   Windows   NT   3.1   or   later.  
      Windows   95/98:   Requires   Windows   95   or   later.  
      Header:   Declared   in   Winbase.h;   include   Windows.h.  
      Library:   Use   Kernel32.lib.  
   
  See   Also  
  Time   Overview,   Time   Functions    
   
  Top

相关问题

  • 延时函数
  • 延时函数
  • TC有记时触发函数吗?
  • delphi延时函数.........?!?!?!?!??
  • 时间的函数?
  • 声明函数时出错?
  • 怎么加时间函数?
  • 怎样写延时函数
  • 延时函数是什么?
  • Access内的时间函数

关键词

  • 函数
  • resolution
  • gettickcount
  • timer
  • elapsed since
  • 记时
  • obtain
  • retrieve
  • was started
  • performance

得分解答快速导航

  • 帖主:bmwer

相关链接

  • CSDN Blog
  • 技术文档
  • 代码下载
  • 第二书店
  • 读书频道

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo