library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub matumoto1234/library

:warning: tools/stopwatch.hpp

Depends on

Code

#pragma once

#include "./base.hpp"

#include <chrono>

namespace matumoto {
  struct Stopwatch {
    chrono::high_resolution_clock::time_point start;

    Stopwatch() {
      restart();
    }

    void restart() {
      start = chrono::high_resolution_clock::now();
    }

    chrono::milliseconds::rep elapsed() {
      auto end = chrono::high_resolution_clock::now();
      return chrono::duration_cast<chrono::milliseconds>(end - start).count();
    }
  };
} // namespace matumoto
#line 2 "tools/stopwatch.hpp"

#line 2 "tools/base.hpp"

namespace matumoto {
  using namespace std;
}
#line 4 "tools/stopwatch.hpp"

#include <chrono>

namespace matumoto {
  struct Stopwatch {
    chrono::high_resolution_clock::time_point start;

    Stopwatch() {
      restart();
    }

    void restart() {
      start = chrono::high_resolution_clock::now();
    }

    chrono::milliseconds::rep elapsed() {
      auto end = chrono::high_resolution_clock::now();
      return chrono::duration_cast<chrono::milliseconds>(end - start).count();
    }
  };
} // namespace matumoto
Back to top page