aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-01-19 18:29:38 +0100
committerShauren <shauren.trinity@gmail.com>2025-01-19 18:29:38 +0100
commitcb4013efe67a875dc19ef3bcd5b8c142f5a131d6 (patch)
treeb00de9bbf536e78a915272fe791856087a999a9a /src/common
parent453ae0ab88eb7c64cb10f35302c337ec99e272b5 (diff)
Core/Misc: Added float chrono typedefs
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Utilities/Duration.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/common/Utilities/Duration.h b/src/common/Utilities/Duration.h
index f506467abda..8ad5be0a10b 100644
--- a/src/common/Utilities/Duration.h
+++ b/src/common/Utilities/Duration.h
@@ -15,22 +15,26 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _DURATION_H_
-#define _DURATION_H_
+#ifndef TRINITYCORE_DURATION_H
+#define TRINITYCORE_DURATION_H
#include <chrono>
/// Milliseconds shorthand typedef.
-typedef std::chrono::milliseconds Milliseconds;
+using Milliseconds = std::chrono::milliseconds;
+using FloatMilliseconds = std::chrono::duration<float, Milliseconds::period>;
/// Seconds shorthand typedef.
-typedef std::chrono::seconds Seconds;
+using Seconds = std::chrono::seconds;
+using FloatSeconds = std::chrono::duration<float, Seconds::period>;
/// Minutes shorthand typedef.
-typedef std::chrono::minutes Minutes;
+using Minutes = std::chrono::minutes;
+using FloatMinutes = std::chrono::duration<float, Minutes::period>;
/// Hours shorthand typedef.
-typedef std::chrono::hours Hours;
+using Hours = std::chrono::hours;
+using FloatHours = std::chrono::duration<float, Hours::period>;
/// time_point shorthand typedefs
typedef std::chrono::steady_clock::time_point TimePoint;
@@ -39,9 +43,9 @@ typedef std::chrono::system_clock::time_point SystemTimePoint;
/// Makes std::chrono_literals globally available.
using namespace std::chrono_literals;
-constexpr std::chrono::hours operator""_days(unsigned long long days)
+constexpr std::chrono::days operator""_days(unsigned long long days)
{
- return std::chrono::hours(days * 24h);
+ return std::chrono::days(days);
}
-#endif // _DURATION_H_
+#endif // TRINITYCORE_DURATION_H