C++Guns – RoboBlog

19.11.2019

C++ Guns: ACPL proudly presents: ElapsedTimer

Filed under: Allgemein — Tags: — Thomas @ 13:11

ElapsedTimer: Measure amount of time with a monotonic clock.

https://sourceforge.net/p/acpl/code/ci/master/tree/acpl/Examples/ElapsedTimer/main.cpp

#include <iostream>
#include <thread>

#include <core/util/ElapsedTimer.hpp>

using namespace acpl;
using namespace std::chrono_literals;

int main() {
    std::cout << "Start timer and wait for 2 seconds ...\n";
    auto timer = ElapsedTimer::create();
    std::this_thread::sleep_for(2s);
    std::cout << timer.elapsed().count() << " seconds later\n";
    return 0;
}

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress