Cleanup of log time display.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@346 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-03-12 23:22:28 +00:00
parent c36ee96550
commit 010d5cfbe3
4 changed files with 34 additions and 22 deletions
+5 -11
View File
@@ -3,6 +3,7 @@
#include <ctime>
#include "canvas.h"
#include "utils.h"
#include "window_log_complete.h"
namespace display {
@@ -34,17 +35,10 @@ WindowLogComplete::redraw() {
m_canvas->print(std::max(0, (int)m_canvas->get_width() / 2 - 5), pos++, "*** Log ***");
for (core::Log::iterator itr = m_log->begin(), e = m_log->end(); itr != e && pos < m_canvas->get_height(); ++itr) {
std::tm *t = std::localtime(&itr->first.tval().tv_sec);
if (t == NULL)
m_canvas->print(0, pos++, "(time error) %s",
itr->second.c_str());
else
m_canvas->print(0, pos++, "(%02i:%02i:%02i) %s",
t->tm_hour, t->tm_min, t->tm_sec,
itr->second.c_str());
}
for (core::Log::iterator itr = m_log->begin(), e = m_log->end(); itr != e && pos < m_canvas->get_height(); ++itr)
m_canvas->print(0, pos++, "(%s) %s",
print_hhmmss(itr->first).c_str(),
itr->second.c_str());
}
void