about summary refs log tree commit diff
path: root/src/rt/sync/timer.h
blob: aae098a1119bc21825902b4d8da0ecf784f5f0d3 (plain)
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
/*
 *  Utility class to measure time in a platform independent way.
 */

#ifndef TIMER_H
#define TIMER_H

class timer {
private:
    uint64_t _start;
    uint64_t _timeout;
    uint64_t get_time();
#if __WIN32__
    uint64_t _ticks_per_us;
#endif
public:
    timer();
    void reset(uint64_t timeout);
    uint64_t get_elapsed_time();
    double get_elapsed_time_in_ms();
    int64_t get_timeout();
    bool has_timed_out();
    virtual ~timer();
};

#endif /* TIMER_H */