⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timetrack.h

📁 clique code with sample data set. clique is a data clustering algorithm which follows hierarchical c
💻 H
字号:
#include <sys/time.h>
#include <unistd.h>  

#define microsec 1000000.0

class TimeTracker {
private:
   struct timeval start_time;
   struct timeval stop_time;
   bool  running;
public:
   TimeTracker() {
      running=false;
   }
   
   void Start() {
      gettimeofday(&start_time, (struct timezone *)0);
      running=true;
   }
   
  double Stop() {
     double st, en;
     if (!running) return(-1.0);
     else {
        gettimeofday(&stop_time, (struct timezone *)0);
        st = start_time.tv_sec + (start_time.tv_usec/microsec);
        en = stop_time.tv_sec + (stop_time.tv_usec/microsec);
        running=false;
        return (double)(en - st);
     }
  }
};


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -