uox3/source/EventTimer.cpp
Xoduz 37a76083de Rest of the changes for 0.99.6-RC1
Misc cleanup and standardization of style and naming conventions in code and scripts
Added missing code for showing race in paperdoll based on ini setting
Players can no longer use Polymorph spell while incognitoed, or while under effect of tribal paint
Players can no longer use Incognito spell while polymorphed, or while under the effects of tribal paint
Facial hair is now removed from players who are under the effects of Incognito spell that changes their gender for female
2022-10-24 18:39:33 +08:00

39 lines
1.8 KiB
C++

#include "EventTimer.hpp"
#include <iostream>
using namespace std::string_literals;
//o------------------------------------------------------------------------------------------------o
//| Function - EventTimer::EventTimer()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Return current time point in frame of the high resolution clock
//o------------------------------------------------------------------------------------------------o
EventTimer::EventTimer()
{
_now = std::chrono::high_resolution_clock::now();
}
//o------------------------------------------------------------------------------------------------o
//| Function - EventTimer::Elapsed()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Return elapsed time since EventTimer was started
//o------------------------------------------------------------------------------------------------o
auto EventTimer::Elapsed( bool reset ) -> long long
{
auto delta = std::chrono::high_resolution_clock::now() - _now;
if( reset )
{
_now = std::chrono::high_resolution_clock::now();
}
return std::chrono::duration_cast<std::chrono::milliseconds>( delta ).count();
}
//o------------------------------------------------------------------------------------------------o
//| Function - EventTimer::output()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Output the elapsed time to console
//o------------------------------------------------------------------------------------------------o
auto EventTimer::Output( const std::string &label = "Delta from last call", bool reset ) -> void
{
std::cout << label << " - "s << Elapsed( reset ) << "(ms)\n"s;
}