Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include"base/dependencies/index.hpp"
- #include"floats.hpp"
- #include"metaprogramming.hpp"
- // Timer utility type.
- class timer{
- // Local type aliases.
- using clock=chrono::steady_clock;
- using time_point=clock::time_point;
- // Starting time.
- static inline time_point const start=clock::now();
- public:
- // Return the number of ticks since the starting time.
- template<Float Rep=f64,class Period=ratio<1>>static Rep elapsed(){
- time_point const now=clock::now();
- return chrono::duration<Rep,Period>{now-start}.count();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement