From d157af5305e5554af27fadbbc3fc47e4e3659cd2 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 28 Dec 2009 20:59:34 +0000 Subject: [PATCH] build fixes --- include/libtorrent/aux_/session_impl.hpp | 3 ++- src/session_impl.cpp | 2 +- src/time.cpp | 25 ++++++++++++++++++------ src/torrent.cpp | 2 +- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index fb885afb3..51c40b972 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -812,7 +812,8 @@ namespace libtorrent void tracker_request_error( tracker_request const& , int response_code - , const std::string& str) + , const std::string& str + , int retry_interval) { char msg[256]; snprintf(msg, sizeof(msg), "*** tracker error: %d: %s", response_code, str.c_str()); diff --git a/src/session_impl.cpp b/src/session_impl.cpp index b395524a3..c25bf31d2 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -537,7 +537,7 @@ namespace aux { if (getrlimit(RLIMIT_NOFILE, &rl) == 0) { #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING - (*m_logger) << time_now_string() << "max number of open files: " << rl.rlim_cur << "\n"; + (*m_logger) << time_now_string() << " max number of open files: " << rl.rlim_cur << "\n"; #endif // deduct some margin for epoll/kqueue, log files, diff --git a/src/time.cpp b/src/time.cpp index b62d9db9b..e49f897db 100644 --- a/src/time.cpp +++ b/src/time.cpp @@ -58,18 +58,31 @@ namespace libtorrent char const* time_now_string() { - time_t t = std::time(0); - tm* timeinfo = std::localtime(&t); - static char str[200]; - std::strftime(str, 200, "%b %d %X", timeinfo); - return str; +// time_t t = std::time(0); +// tm* timeinfo = std::localtime(&t); +// static char str[200]; +// std::strftime(str, 200, "%b %d %X", timeinfo); +// return str; + + static const ptime start = time_now_hires(); + static char ret[200]; + int t = total_milliseconds(time_now_hires() - start); + int h = t / 1000 / 60 / 60; + t -= h * 60 * 60 * 1000; + int m = t / 1000 / 60; + t -= m * 60 * 1000; + int s = t / 1000; + t -= s * 1000; + int ms = t; + snprintf(ret, sizeof(ret), "%02d:%02d:%02d.%03d", h, m, s, ms); + return ret; } std::string log_time() { static const ptime start = time_now_hires(); char ret[200]; - std::sprintf(ret, "%d", total_milliseconds(time_now() - start)); + snprintf(ret, sizeof(ret), "%d", total_milliseconds(time_now_hires() - start)); return ret; } } diff --git a/src/torrent.cpp b/src/torrent.cpp index 2807d16bc..f5e952205 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -3148,7 +3148,7 @@ namespace libtorrent #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING (*m_ses.m_logger) << time_now_string() << " completed resolve proxy hostname for: " << web.url << "\n"; - if (ec) + if (e) *m_ses.m_logger << time_now_string() << " on_proxy_name_lookup: " << e.message() << "\n"; #endif