#include "widget.h"

#include <QApplication>
#include "Logs/loginit.h"
#include "spdlog/spdlog.h"
#include "Timer/TWTimer.hpp"

std::chrono::steady_clock::time_point lastTime = std::chrono::steady_clock::now();
long count = 0;


void print()
{
    std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
    SPDLOG_INFO("count:{} 间隔: {} us",count, std::chrono::duration_cast<std::chrono::microseconds>(now - lastTime).count());
    lastTime = now;
    count++;
}

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    init_log();

    SPDLOG_INFO("********** Timer **********");

    TimerWheel timer;
    timer.Start();

    timer.AddTask(1000, print, true);

    return a.exec();
}