-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Core/DB): port WarheadCore database
- Loading branch information
1 parent
9d7e472
commit cd033b2
Showing
213 changed files
with
5,193 additions
and
4,867 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Affero General Public License as published by the | ||
* Free Software Foundation; either version 3 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef AC_STOP_WATCH_H_ | ||
#define AC_STOP_WATCH_H_ | ||
|
||
#include "Timer.h" | ||
#include <fmt/core.h> | ||
|
||
class StopWatch | ||
{ | ||
using clock = std::chrono::steady_clock; | ||
|
||
public: | ||
explicit StopWatch(uint8 outCount = 3) | ||
: _startTime{ clock::now() }, _outCount{ outCount } {} | ||
|
||
[[nodiscard]] Microseconds Elapsed() const | ||
{ | ||
return std::chrono::duration_cast<Microseconds>(clock::now() - _startTime); | ||
} | ||
|
||
void Reset() | ||
{ | ||
_startTime = clock::now(); | ||
} | ||
|
||
[[nodiscard]] uint8 GetOutCount() const | ||
{ | ||
return _outCount; | ||
} | ||
|
||
private: | ||
std::chrono::time_point<clock> _startTime; | ||
uint8 _outCount; | ||
}; | ||
|
||
template<> | ||
struct fmt::formatter<StopWatch> : formatter<string_view> | ||
{ | ||
template<typename FormatContext> | ||
auto format(const StopWatch& sw, FormatContext& ctx) -> decltype(ctx.out()) | ||
{ | ||
return formatter<string_view>::format(Acore::Time::ToTimeString(sw.Elapsed(), sw.GetOutCount()), ctx); | ||
} | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.