Files
Adaptix-Framework-AdaptixC2/AdaptixClient/Source/Client/LastTickWorker.cpp
T
2025-03-13 09:17:57 +03:00

28 lines
707 B
C++

#include <Client/LastTickWorker.h>
#include <Agent/Agent.h>
LastTickWorker::LastTickWorker(AdaptixWidget *w)
{
mainWidget = w;
timer = new QTimer(this);
}
LastTickWorker::~LastTickWorker() = default;
void LastTickWorker::run()
{
QObject::connect( timer, &QTimer::timeout, this, &LastTickWorker::updateLastItems );
timer->start( 1000 );
}
void LastTickWorker::updateLastItems() const
{
for ( auto agent : mainWidget->AgentsMap ) {
if ( agent->data.Async && agent->active ) {
int current = QDateTime::currentSecsSinceEpoch();
int diff = current - agent->data.LastTick;
agent->item_Last->setText( FormatSecToStr(diff) );
}
}
}