diff options
author | Andrej Sinicyn <andrej4000@gmail.com> | 2005-09-21 14:00:11 +0000 |
---|---|---|
committer | Andrej Sinicyn <andrej4000@gmail.com> | 2005-09-21 14:00:11 +0000 |
commit | 59796855784a34e35d09c5cb3750dd5a9b421c10 (patch) | |
tree | 10b1ac8b1b3f732a0e5967871c8922302958bcf3 /src/gui | |
parent | f68d74096271ef617bf700810b0e94d1efcff6ab (diff) | |
download | mana-59796855784a34e35d09c5cb3750dd5a9b421c10.tar.gz mana-59796855784a34e35d09c5cb3750dd5a9b421c10.tar.bz2 mana-59796855784a34e35d09c5cb3750dd5a9b421c10.tar.xz mana-59796855784a34e35d09c5cb3750dd5a9b421c10.zip |
Show time of the messages in the chat window.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chat.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
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 <sstream> + #include <guichan/focushandler.hpp> #include <guichan/key.hpp> @@ -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()); |