aboutsummaryrefslogtreecommitdiff
path: root/src/common/Utilities/Util.h
diff options
context:
space:
mode:
authorForesterDev <11771800+ForesterDev@users.noreply.github.com>2020-02-23 00:31:37 +0400
committerShauren <shauren.trinity@gmail.com>2021-12-22 01:25:24 +0100
commit69f768605082222a3ca573c623d3fc019106be3b (patch)
tree1045f82caa4c7eb3709033e57b250784e6d06956 /src/common/Utilities/Util.h
parent1d08423725141de712290b18739dcc9b3ea3a7c6 (diff)
Core/Server: correct timestamp format for shutdown/restart notification broadcasts (#24181)
* Core/SmartScripts: implement SMART_ACTION_OVERRIDE_LIGHT and SMART_ACTION_OVERRIDE_WEATHER * Core/Server: correct timestamp format for shutdown/restart notification broadcasts * remove unexpected changes * move enum from Common to Util * Use enum class instead of enum * Fix width for seconds 0 to 9 (cherry picked from commit 69231581e4f2d78384d3efe6f613be1b78e9d40f)
Diffstat (limited to 'src/common/Utilities/Util.h')
-rw-r--r--src/common/Utilities/Util.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h
index 879ec4e0f67..5a51c545859 100644
--- a/src/common/Utilities/Util.h
+++ b/src/common/Utilities/Util.h
@@ -28,6 +28,13 @@
enum LocaleConstant : uint8;
+enum class TimeFormat : uint8
+{
+ FullText, // 1 Days 2 Hours 3 Minutes 4 Seconds
+ ShortText, // 1d 2h 3m 4s
+ Numeric // 1:2:3:4
+};
+
class TC_COMMON_API Tokenizer
{
public:
@@ -63,7 +70,7 @@ TC_COMMON_API time_t LocalTimeToUTCTime(time_t time);
TC_COMMON_API time_t GetLocalHourTimestamp(time_t time, uint8 hour, bool onlyAfterTime = true);
TC_COMMON_API tm TimeBreakdown(time_t t);
-TC_COMMON_API std::string secsToTimeString(uint64 timeInSecs, bool shortText = false, bool hoursOnly = false);
+TC_COMMON_API std::string secsToTimeString(uint64 timeInSecs, TimeFormat timeFormat = TimeFormat::FullText, bool hoursOnly = false);
TC_COMMON_API uint32 TimeStringToSecs(std::string const& timestring);
TC_COMMON_API std::string TimeToTimestampStr(time_t t);
TC_COMMON_API std::string TimeToHumanReadable(time_t t);