1234567891011121314151617181920212223242526 |
- #ifndef CLOCK_H
- #define CLOCK_H
- #include "common/utils/Types.h"
- #include "common/utils/Array.h"
- class Clock final {
- public:
- Clock();
- u64 update();
- u64 getLength() const;
- float getUpdatesPerSecond() const;
- void wait(u64 nanos) const;
- private:
- u64 getNanos() const;
-
- static constexpr u64 bits = 7;
- static constexpr u64 length = 1 << bits;
- u64 last;
- u64 index;
- s64 sum;
- Array<u64, length> time;
- };
- #endif
|