GetTickCount(),这个函数,在此做下整理和总结。
1.定义
For Release configurations, this function returns the number of milliseconds since the device booted, excluding any time that the system was suspended. GetTickCount starts at 0 on boot and then counts up from there.
在Release版本中,该函数从0开始计时,返回自设备启动后的毫秒数(不含系统暂停时间)。
For Debug configurations, 180 seconds is subtracted from the the number of milliseconds since the device booted. This allows code that uses GetTickCount to be easily tested for correct overflow handling.
在Debug版本中,设备启动后便从计时器中减去180秒。这样方便测试使用该函数的代码的正确溢出处理。
return values
The number of milliseconds indicates success.
返回值:如正确,返回毫秒数。
2.用法及应用
(1)用来计算系统所用时间,即计算两个时间点的时间间隔
DWORD dwStart = ::GetTickCount();
//执行操作
.......
DWORD dwStop = ::GetTickCount();
DWORD dwInterval = dwStop - dwStart;
(2)用于定时
用于定时器效果,比如用于60秒倒计时:
static int n_gTimeout = 0
n_gTimeout  = ::GetTickCount()/1000;
//....执行操作
int nInterval = ::GetTickCount()/1000 - n_gTimeout;
if(nInterval >=60)
{
  return;
}
m_nTimeOut = 60 - nInterval;//倒计时时刻

GetTickCount()函数的更多相关文章

  1. getTickCount()函数 VS GetTickCount()函数

    这俩函数看上去长得太像了,笔者曾经马大哈地把两者当成一个函数了(确实长得很像),知道有一天发现返回的值离预期值差很远差仔细查了下. 1. getTickCount() 实际上,该函数为opencv中的 ...

  2. rand()和srand()GetTickCount函数用法

    标准库<cstdlib>(被包含于<iostream>中)提供两个帮助生成伪随机数的函数: 函数一:int rand(void):从srand (seed)中指定的seed开始 ...

  3. GetTickCount()函数的陷阱!

    开发中经经常使用GetTickCount()函数来进行间隔时间的推断.如推断某一段代码运行花了多少时间等,使用比較方便. 可是仅仅针对寻常的一些測试.近期开发一个服务程序时,也在代码中用GetTick ...

  4. GetTickCount() 函数的作用和用法

    今天项目中60秒倒计时模块需要用到GetTickCount(),这个函数,在此做下整理和总结. 1.定义 For Release configurations, this function retur ...

  5. c、c++---linux上的GetTickCount函数

    http://blog.csdn.net/guang11cheng/article/details/6865992 http://wenda.so.com/q/1378766306062794

  6. 时间的函数,sleep,clock,gettickcount,QueryPerformanceCounter(转)

    介绍 我 们在衡量一个函数运行时间,或者判断一个算法的时间效率,或者在程序中我们需要一个定时器,定时执行一个特定的操作,比如在多媒体中,比如在游戏中等,都 会用到时间函数.还比如我们通过记录函数或者算 ...

  7. opencv —— getTickCount、getTickFrequency 计时函数

    getTickCount 函数 返回 CPU 自某个事件(如启动电脑)以来走过的时钟周期数. getTickFrequency 函数 返回 CPU 一秒钟所走过的时钟周期数. 二者结合使用,可以用来计 ...

  8. 教程-Delphi源代码--后延函数

    说明: 1)TTtimer控件 TTtimer控件的实质是调用WindowsAPI定时函数SetTimer和KillTimer来实现的,并简化了对WM_TIMER消息的处理过程.通过设置OnTimer ...

  9. 一个在字符串中查找多个关键字的函数strstrs(三种不同算法实现及效率分析)

    平时项目中有时需要用到在字符串中搜索两个或更多的关键字的情景.例如:将字符串"ab|cd#ef|"按竖线或者井号做分隔 如果是大项目,一般会采用正则表达式做处理.但有时写个小程序, ...

随机推荐

  1. JDBC中 execute 与 executeUpdate的区别

    相同点 execute与executeUpdate的相同点:都可以执行增加,删除,修改 不同点 execute可以执行查询语句 然后通过getResultSet,把结果集取出来 executeUpda ...

  2. kafka删除一个topic

    前言 当我们在shell中执行topic删除命令的时候` kafka-topics --delete --topic xxxx --zookeeper xxx`,会显示,xxxx已经被标记为删除.然后 ...

  3. Could not find a package configuration file provided by 'ecl_threads' ,.................couldn't find required component 'ecl_threads'

    sudo apt-get install ros-kinetic-ecl-threads

  4. string 和 wstring

    区别: char* wchar_t 一个字节 两个字节 ACSII编码 unicode编码 转换: 1.Windows API WideCharToMultiByte() MultiByteToWid ...

  5. Qt5.3.2_CentOS6.4_单步调试环境__20160306【勿删,繁琐】

    20160306 全程没有f/q ZC:使用的虚拟机环境是:博客园VMwareSkill 的 “CentOS6.4_x86_120g__20160306.rar” 需要调试器 gdb ,从“http: ...

  6. java中的值传递和引用传递用法详解

    值传递:方法调用时,实际参数把它的值传递给对应的形式参数,方法执行中形式参数值的改变不影响实际参 数的值. 引用传递:也称为传地址.方法调用时,实际参数的引用(地址,而不是参数的值)被传递给方法中相对 ...

  7. Android 实现文件上传功能(upload)

    文 件上传在B/S应用中是一种十分常见的功能,那么在Android平台下是否可以实现像B/S那样的文件上传功能呢?答案是肯定的.下面是一个模拟网站程 序上传文件的例子.这里只写出了Android部分的 ...

  8. UVA - 11853 Paintball(dfs)

    UVA - 11853 思路:dfs,从最上面超过上边界的圆开始搜索,看能不能搜到最下面超过下边界的圆. 代码: #include<bits/stdc++.h> using namespa ...

  9. getpagesize.c:32: __getpagesize: Assertion `_rtld_global_ro._dl_pagesize != 0' failed

    为arm 编译 mysql , 执行的时候出现了这个问题. 好像是个bug, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626379 重新编译 ...

  10. English trip V1 - 1.How Do You Feel Now? Teacher:Lamb Key:形容词(Adjectives)

    In this lesson you will learn to describe people, things, and feelings.在本课中,您将学习如何描述人,事和感受. STARTER  ...