Clock.h 402 B

123456789101112131415161718192021222324
  1. #ifndef CLOCK_H
  2. #define CLOCK_H
  3. #include "utils/Array.h"
  4. #include "rendering/wrapper/GLFW.h"
  5. class Clock final {
  6. static constexpr int bits = 7;
  7. static constexpr int length = 1 << bits;
  8. int index;
  9. Nanos last;
  10. Nanos sum;
  11. Array<Nanos, length> time;
  12. public:
  13. Clock();
  14. Nanos update();
  15. Nanos getLength() const;
  16. float getUpdatesPerSecond() const;
  17. };
  18. #endif