summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tabs
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/tabs')
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
index 52ec7fb4f..48c0669fc 100644
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ b/src/gui/widgets/tabs/chat/chattab.cpp
@@ -246,32 +246,19 @@ void ChatTab::chatLog(std::string line,
time_t t;
time(&t);
- if (config.getBoolValue("useLocalTime"))
+ const tm* const timeInfo =
+ config.getBoolValue("useLocalTime") ? localtime(&t) : gmtime(&t);
+
+ if (timeInfo != nullptr)
{
- const tm *const timeInfo = localtime(&t);
- if (timeInfo != nullptr)
- {
- line = strprintf("%s[%02d:%02d] %s%s", lineColor.c_str(),
- timeInfo->tm_hour, timeInfo->tm_min, tmp.nick.c_str(),
- tmp.text.c_str());
- }
- else
- {
- line = strprintf("%s %s%s", lineColor.c_str(),
- tmp.nick.c_str(), tmp.text.c_str());
- }
+ line = strprintf("%s[%02d:%02d] %s%s", lineColor.c_str(),
+ timeInfo->tm_hour, timeInfo->tm_min,
+ tmp.nick.c_str(), tmp.text.c_str());
}
else
{
- // Format the time string properly
- std::stringstream timeStr;
- timeStr << "[" << ((((t / 60) / 60) % 24 < 10) ? "0" : "")
- << CAST_S32(((t / 60) / 60) % 24)
- << ":" << (((t / 60) % 60 < 10) ? "0" : "")
- << CAST_S32((t / 60) % 60)
- << "] ";
- line = std::string(lineColor).append(timeStr.str()).append(
- tmp.nick).append(tmp.text);
+ line = strprintf("%s %s%s", lineColor.c_str(),
+ tmp.nick.c_str(), tmp.text.c_str());
}
if (config.getBoolValue("enableChatLog"))