File: timer.h

package info (click to toggle)
kmc 2.3%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,412 kB
  • sloc: cpp: 17,316; perl: 178; makefile: 90; sh: 16
file content (33 lines) | stat: -rw-r--r-- 646 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
  This file is a part of KMC software distributed under GNU GPL 3 licence.
  The homepage of the KMC project is http://sun.aei.polsl.pl/kmc
  
  Authors: Marek Kokot
  
  Version: 2.3.0
  Date   : 2015-08-21
*/

#ifndef _TIMER_H
#define _TIMER_H

#include <chrono>
class CTimer
{
	using time_p = std::chrono::system_clock::time_point;
	time_p _start, _end;
public:
	void start()
	{
		_start = std::chrono::high_resolution_clock::now();
	}
	double get_time()
	{
		auto time = std::chrono::high_resolution_clock::now() - _start;
		return static_cast<double>(std::chrono::duration_cast<std::chrono::milliseconds>(time).count());
	}
};



#endif