diff options
author | ForesterDev <11771800+ForesterDev@users.noreply.github.com> | 2020-02-23 00:31:37 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-22 21:31:37 +0100 |
commit | 69231581e4f2d78384d3efe6f613be1b78e9d40f (patch) | |
tree | 7c5c6cc74c1dbade0e8c52dcc153110f6ff78de6 /src/common/Utilities/Util.h | |
parent | c65ba35269a68c94c3e423f78fa1585f9d89dd04 (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
Diffstat (limited to 'src/common/Utilities/Util.h')
-rw-r--r-- | src/common/Utilities/Util.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h index 518608a6431..4915df56477 100644 --- a/src/common/Utilities/Util.h +++ b/src/common/Utilities/Util.h @@ -26,6 +26,13 @@ #include <utility> #include <vector> +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: @@ -61,7 +68,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); |