TrinityCore
Duration.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_DURATION_H
19#define TRINITYCORE_DURATION_H
20
21#include <chrono>
22
24using Milliseconds = std::chrono::milliseconds;
25using FloatMilliseconds = std::chrono::duration<float, Milliseconds::period>;
26
28using Seconds = std::chrono::seconds;
29using FloatSeconds = std::chrono::duration<float, Seconds::period>;
30
32using Minutes = std::chrono::minutes;
33using FloatMinutes = std::chrono::duration<float, Minutes::period>;
34
36using Hours = std::chrono::hours;
37using FloatHours = std::chrono::duration<float, Hours::period>;
38
40typedef std::chrono::steady_clock::time_point TimePoint;
41typedef std::chrono::system_clock::time_point SystemTimePoint;
42
44using namespace std::chrono_literals;
45
46constexpr std::chrono::days operator""_days(unsigned long long days)
47{
48 return std::chrono::days(days);
49}
50
51#endif // TRINITYCORE_DURATION_H
std::chrono::duration< float, Milliseconds::period > FloatMilliseconds
Definition: Duration.h:25
std::chrono::system_clock::time_point SystemTimePoint
Definition: Duration.h:41
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:24
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:28
std::chrono::duration< float, Hours::period > FloatHours
Definition: Duration.h:37
std::chrono::duration< float, Minutes::period > FloatMinutes
Definition: Duration.h:33
std::chrono::steady_clock::time_point TimePoint
time_point shorthand typedefs
Definition: Duration.h:40
std::chrono::duration< float, Seconds::period > FloatSeconds
Definition: Duration.h:29
std::chrono::hours Hours
Hours shorthand typedef.
Definition: Duration.h:36
std::chrono::minutes Minutes
Minutes shorthand typedef.
Definition: Duration.h:32