From 59796855784a34e35d09c5cb3750dd5a9b421c10 Mon Sep 17 00:00:00 2001 From: Andrej Sinicyn Date: Wed, 21 Sep 2005 14:00:11 +0000 Subject: Show time of the messages in the chat window. --- src/gui/chat.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 70b39ae3..ab654440 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -23,6 +23,8 @@ #include "chat.h" +#include + #include #include @@ -144,7 +146,21 @@ void ChatWindow::chat_log(std::string line, int own) break; } - line = lineColor + tmp.nick + line; + // Get the current system time + time_t t; + time(&t); + + // Format the time string properly + std::stringstream timeStr; + timeStr << "["; + timeStr << ((((t / 60) / 60) % 24 < 10) ? "0" : ""); + timeStr << (int)(((t / 60) / 60) % 24); + timeStr << ":"; + timeStr << (((t / 60) % 60 < 10) ? "0" : ""); + timeStr << (int)((t / 60) % 60); + timeStr << "] "; + + line = lineColor + timeStr.str() + tmp.nick + line; textOutput->addRow(line); scrollArea->setVerticalScrollAmount(scrollArea->getVerticalMaxScroll()); -- cgit v1.2.3-70-g09d2