Skip to content

Commit

Permalink
core: Modernize lowres_clock_impl declaration
Browse files Browse the repository at this point in the history
- Prefer `using` to `typedef`.

- Prefer explicit default initialization.
  • Loading branch information
Jesse Haber-Kucharsky committed Jun 19, 2017
1 parent 34b6807 commit dc0c4ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/lowres_clock.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ class lowres_clock;

class lowres_clock_impl final {
public:
typedef std::chrono::steady_clock base_clock;
using base_clock = std::chrono::steady_clock;

typedef base_clock::rep rep;
using rep = base_clock::rep;
// The lowres_clock's resolution is 10ms. However, to make it is easier to
// do calcuations with std::chrono::milliseconds, we make the clock's
// period to 1ms instead of 10ms.
typedef std::ratio<1, 1000> period;
typedef std::chrono::duration<rep, period> duration;
typedef std::chrono::time_point<lowres_clock, duration> time_point;
using period = std::ratio<1, 1000>;
using duration = std::chrono::duration<rep, period>;
using time_point = std::chrono::time_point<lowres_clock, duration>;

static time_point now() {
auto nr = _now.load(std::memory_order_relaxed);
Expand All @@ -59,7 +59,7 @@ private:
static constexpr std::chrono::milliseconds _granularity{10};

// High resolution timer to drive this low resolution clock
timer<> _timer;
timer<> _timer{};

static void update();
};
Expand Down

0 comments on commit dc0c4ba

Please sign in to comment.