1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

replace boost::chrono with std::chrono

This commit is contained in:
Andrey Filipenkov 2021-11-23 09:41:03 +03:00
parent a65feb29f5
commit fc064b1c45
6 changed files with 14 additions and 12 deletions

View File

@ -378,11 +378,11 @@ bool isWeeklyRevisitable(const CGObjectInstance * obj)
return false;
}
uint64_t timeElapsed(boost::chrono::time_point<boost::chrono::steady_clock> start)
uint64_t timeElapsed(std::chrono::time_point<std::chrono::steady_clock> start)
{
auto end = boost::chrono::high_resolution_clock::now();
auto end = std::chrono::high_resolution_clock::now();
return boost::chrono::duration_cast<boost::chrono::milliseconds>(end - start).count();
return std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
}
// todo: move to obj manager
@ -492,4 +492,4 @@ bool shouldVisit(const Nullkiller * ai, const CGHeroInstance * h, const CGObject
return false;
return true;
}
}

View File

@ -49,6 +49,8 @@
#include "../../lib/mapObjects/CGHeroInstance.h"
#include "../../lib/CPathfinder.h"
#include <chrono>
using namespace tbb;
class CCallback;
@ -216,7 +218,7 @@ bool compareHeroStrength(HeroPtr h1, HeroPtr h2);
bool compareArmyStrength(const CArmedInstance * a1, const CArmedInstance * a2);
bool compareArtifacts(const CArtifactInstance * a1, const CArtifactInstance * a2);
uint64_t timeElapsed(boost::chrono::time_point<boost::chrono::steady_clock> start);
uint64_t timeElapsed(std::chrono::time_point<std::chrono::steady_clock> start);
// todo: move to obj manager
bool shouldVisit(const Nullkiller * ai, const CGHeroInstance * h, const CGObjectInstance * obj);

View File

@ -19,7 +19,7 @@ void DangerHitMapAnalyzer::updateHitMap()
logAi->trace("Update danger hitmap");
upToDate = true;
auto start = boost::chrono::high_resolution_clock::now();
auto start = std::chrono::high_resolution_clock::now();
auto cb = ai->cb.get();
auto mapSize = ai->cb->getMapSize();

View File

@ -178,7 +178,7 @@ bool ObjectClusterizer::shouldVisitObject(const CGObjectInstance * obj) const
void ObjectClusterizer::clusterize()
{
auto start = boost::chrono::high_resolution_clock::now();
auto start = std::chrono::high_resolution_clock::now();
nearObjects.reset();
farObjects.reset();
@ -349,4 +349,4 @@ void ObjectClusterizer::clusterize()
}
logAi->trace("Clusterization complete in %ld", timeElapsed(start));
}
}

View File

@ -73,7 +73,7 @@ Goals::TTask Nullkiller::choseBestTask(Goals::TSubgoal behavior, int decompositi
{
logAi->debug("Checking behavior %s", behavior->toString());
auto start = boost::chrono::high_resolution_clock::now();
auto start = std::chrono::high_resolution_clock::now();
Goals::TGoalVec elementarGoals = decomposer->decompose(behavior, decompositionMaxDepth);
Goals::TTaskVec tasks;
@ -122,7 +122,7 @@ void Nullkiller::updateAiState(int pass)
{
boost::this_thread::interruption_point();
auto start = boost::chrono::high_resolution_clock::now();
auto start = std::chrono::high_resolution_clock::now();
activeHero = nullptr;
@ -293,4 +293,4 @@ TResources Nullkiller::getFreeResources() const
void Nullkiller::lockResources(const TResources & res)
{
lockedResources += res;
}
}

View File

@ -49,7 +49,7 @@ void AIPathfinder::updatePaths(std::map<const CGHeroInstance *, HeroRole> heroes
storage.reset(new AINodeStorage(ai, cb->getMapSize()));
}
auto start = boost::chrono::high_resolution_clock::now();
auto start = std::chrono::high_resolution_clock::now();
logAi->debug("Recalculate all paths");
int pass = 0;