noya2_Library

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

View the Project on GitHub noya2ruler/noya2_Library

:warning: misc/timer.hpp

Code

#pragma once

#include<chrono>
#include<iostream>

namespace noya2{

struct Timer {
  private:
    std::chrono::high_resolution_clock::time_point start, end;
 
  public:
    Timer() { set(); }
    void set() { start = std::chrono::high_resolution_clock::now(); }
    int time() {
        end = std::chrono::high_resolution_clock::now();
        return std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
    }
    double dtime(){
        return (double)(time()) / 1000;
    }
    bool before(double T) { return time() < (int)(T * 1000); }
    void print() { std::cerr << "elapsed time: " << (double)time() / 1000 << " sec" << std::endl; }
};

} // namespace noya2
#line 2 "misc/timer.hpp"

#include<chrono>
#include<iostream>

namespace noya2{

struct Timer {
  private:
    std::chrono::high_resolution_clock::time_point start, end;
 
  public:
    Timer() { set(); }
    void set() { start = std::chrono::high_resolution_clock::now(); }
    int time() {
        end = std::chrono::high_resolution_clock::now();
        return std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
    }
    double dtime(){
        return (double)(time()) / 1000;
    }
    bool before(double T) { return time() < (int)(T * 1000); }
    void print() { std::cerr << "elapsed time: " << (double)time() / 1000 << " sec" << std::endl; }
};

} // namespace noya2
Back to top page