Orbiter 2022
Combinatorial Objects
chrono.h
Go to the documentation of this file.
1/*
2 * File: chrono.h
3 * Author: Sajeeb
4 *
5 * Created on October 26, 2017, 5:02 PM
6 */
7
12#ifndef CHRONO_H
13#define CHRONO_H
14
15#include <math.h>
16#include <cmath>
17#include <chrono>
18
19
21
22class chrono_ {
23public:
24 chrono_() { start(); }
26 }
27 void start() {
28 auto now = std::chrono::system_clock::now();
29 auto now_ns = std::chrono::time_point_cast<std::chrono::nanoseconds>(now);
30 auto epoch = now_ns.time_since_epoch();
31 auto value = std::chrono::duration_cast<std::chrono::nanoseconds>(epoch);
32 timestamp = value.count();
33 }
34 long calculateDuration(const chrono_& c) {
35 return (c.timestamp-timestamp);
36 }
37 void reset() { start(); }
39private:
40 static const bool debug = false;
41};
42
43#endif /* CHRONO_H */
measure elapsed time
Definition: chrono.h:22
void reset()
Definition: chrono.h:37
~chrono_()
Definition: chrono.h:25
long calculateDuration(const chrono_ &c)
Definition: chrono.h:34
chrono_()
Definition: chrono.h:24
long timestamp
Definition: chrono.h:38
void start()
Definition: chrono.h:27