From 28d6ff35b0f492f2054deea8bb43cce045b320d5 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Mon, 5 Feb 2024 00:52:14 -0500
Subject: [PATCH] Restore chat timestamp option

---
 indra/newview/llfloaterimsessiontab.cpp | 5 ++++-
 indra/newview/lllogchat.cpp             | 8 ++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index b6c1481d324..c4b0574abd9 100644
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -433,7 +433,10 @@ std::string LLFloaterIMSessionTab::appendTime()
 	time_t utc_time = time_corrected();
 
 	static const std::string time_str = fmt::format(FMT_STRING("[{}]:[{}]"), LLTrans::getString("TimeHour"), LLTrans::getString("TimeMin"));
-	std::string timeStr = time_str;
+	static const std::string time_str_seconds = fmt::format(FMT_STRING("[{}]:[{}]:[{}]"), LLTrans::getString("TimeHour"), LLTrans::getString("TimeMin"), LLTrans::getString("TimeSec"));
+	static const LLCachedControl<bool> show_timestamp_seconds(gSavedSettings, "ChatTimestampSeconds", false);
+
+	std::string timeStr = show_timestamp_seconds ? time_str_seconds : time_str;
 
 	LLSD substitution;
 	substitution["datetime"] = (S32) utc_time;
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 949a2362ee2..dfb458e7d5e 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -301,16 +301,20 @@ std::string LLLogChat::cleanFileName(std::string filename)
 
 std::string LLLogChat::timestamp2LogString(U32 timestamp, bool withdate)
 {
+	static const LLCachedControl<bool> show_timestamp_seconds(gSavedSettings, "ChatTimestampSeconds", false);
+
 	std::string timeStr;
 	if (withdate)
 	{
 		static const std::string timestamp_long_fmt = fmt::format(FMT_STRING("[{}]/[{}]/[{}] [{}]:[{}]"), LLTrans::getString("TimeYear"), LLTrans::getString("TimeMonth"), LLTrans::getString("TimeDay"), LLTrans::getString("TimeHour"), LLTrans::getString("TimeMin"));
-        timeStr = timestamp_long_fmt;
+		static const std::string timestamp_long_sec_fmt = fmt::format(FMT_STRING("[{}]/[{}]/[{}] [{}]:[{}]:[{}]"), LLTrans::getString("TimeYear"), LLTrans::getString("TimeMonth"), LLTrans::getString("TimeDay"), LLTrans::getString("TimeHour"), LLTrans::getString("TimeMin"), LLTrans::getString("TimeSec"));
+        timeStr = show_timestamp_seconds ? timestamp_long_sec_fmt : timestamp_long_fmt;
 	}
 	else
 	{
 		static const std::string timestamp_short_fmt = fmt::format(FMT_STRING("[{}]:[{}]"), LLTrans::getString("TimeHour"), LLTrans::getString("TimeMin"));
-        timeStr = timestamp_short_fmt;
+		static const std::string timestamp_short_sec_fmt = fmt::format(FMT_STRING("[{}]:[{}]:[{}]"), LLTrans::getString("TimeHour"), LLTrans::getString("TimeMin"), LLTrans::getString("TimeSec"));
+        timeStr = show_timestamp_seconds ? timestamp_short_sec_fmt : timestamp_short_fmt;
 	}
 
 	LLSD substitution;
-- 
GitLab