一个不错的计时器类
2011-08-24 04:24
148 查看
/* * Timer Class * By Danny Battison * gabehabe@hotmail.com */ #include <ctime> class CTimer { public: // everything is public for ease of access // begin/end variables clock_t begin; clock_t end; // variable declarations used for time calculation double elapTicks; double elapMilli, elapSeconds, elapMinutes; // constructor CTimer () {} //call myTimer.begin () to begin the timer void start() { this->begin = clock () * CLK_TCK; } // call myTimer.stop () to stop the timer void stop () { this->end = clock () * CLK_TCK; getTimes (); } // call getTimes void getTimes () { // variable definitions on to calculate time taken this->elapTicks = this->end - this->begin; // stop the timer, and calculete the time taken this->elapMilli = this->elapTicks/1000; //milliseconds from Begin to End this->elapSeconds = this->elapMilli/1000; //seconds from Begin to End this->elapMinutes = this->elapSeconds/60; //minutes from Begin to End } };
相关文章推荐
- 一个不错的PHP缓存类介绍和PHP缓存函数介绍以及使用
- 介绍一个不错的JQuery弹出框组件
- 如何成为Linux平台C语言程序员(如果感觉不错就给顶一个)转载!
- 一个比较不错的Linux论坛--redhat培训
- 实现一个很简单的计时器类
- 一个不错的技术文章网站
- 不错的文本整理软件,本来想自己写一个,不过林子大了,不用写了
- AWR Formatter (一个不错的AWR报告格式化google chrome 插件)
- mt.exe.一个不错的东西,功能很强大
- 推荐一个站点:里面有很多不错的长文
- 一个不错的mac软件下载站,mark一下 (商业使用请务必支持正版)
- 一个不错的介绍企业应用集成和ESB的PPT
- 一个不错的Curl教程
- 分享一个不错的squid 配置文件
- 一个不错opengl 博客
- 一个不错的介绍企业应用集成和ESB的PPT
- 一个不错的工具 svk备份 etc并带有版本管理功能
- 一个不错的JS特效
- 一个不错的PHP点评系统
- 一个非常不错的Email地址校验函数