library

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


Project maintained by tko919 Hosted on GitHub Pages — Theme by mattgraham

:warning: Timer
(Utility/timer.hpp)

Code

#pragma once
#include <chrono>


class timer_ {
    std::chrono::system_clock::time_point start_;

  public:
    timer_() : start_(now()) {}
    static std::chrono::system_clock::time_point now() {
        return std::chrono::system_clock::now();
    }
    int spent_ms() const {
        auto diff = now() - start_;
        return std::chrono::duration_cast<std::chrono::milliseconds>(diff)
            .count();
    }
} timer;

/**
 * @brief Timer
 */
#line 2 "Utility/timer.hpp"
#include <chrono>


class timer_ {
    std::chrono::system_clock::time_point start_;

  public:
    timer_() : start_(now()) {}
    static std::chrono::system_clock::time_point now() {
        return std::chrono::system_clock::now();
    }
    int spent_ms() const {
        auto diff = now() - start_;
        return std::chrono::duration_cast<std::chrono::milliseconds>(diff)
            .count();
    }
} timer;

/**
 * @brief Timer
 */
Back to top page