build fixes

This commit is contained in:
Arvid Norberg 2009-12-28 20:59:34 +00:00
parent baa6ea74b8
commit d157af5305
4 changed files with 23 additions and 9 deletions

View File

@ -812,7 +812,8 @@ namespace libtorrent
void tracker_request_error( void tracker_request_error(
tracker_request const& tracker_request const&
, int response_code , int response_code
, const std::string& str) , const std::string& str
, int retry_interval)
{ {
char msg[256]; char msg[256];
snprintf(msg, sizeof(msg), "*** tracker error: %d: %s", response_code, str.c_str()); snprintf(msg, sizeof(msg), "*** tracker error: %d: %s", response_code, str.c_str());

View File

@ -537,7 +537,7 @@ namespace aux {
if (getrlimit(RLIMIT_NOFILE, &rl) == 0) if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
{ {
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING #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 #endif
// deduct some margin for epoll/kqueue, log files, // deduct some margin for epoll/kqueue, log files,

View File

@ -58,18 +58,31 @@ namespace libtorrent
char const* time_now_string() char const* time_now_string()
{ {
time_t t = std::time(0); // time_t t = std::time(0);
tm* timeinfo = std::localtime(&t); // tm* timeinfo = std::localtime(&t);
static char str[200]; // static char str[200];
std::strftime(str, 200, "%b %d %X", timeinfo); // std::strftime(str, 200, "%b %d %X", timeinfo);
return str; // 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() std::string log_time()
{ {
static const ptime start = time_now_hires(); static const ptime start = time_now_hires();
char ret[200]; 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; return ret;
} }
} }

View File

@ -3148,7 +3148,7 @@ namespace libtorrent
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
(*m_ses.m_logger) << time_now_string() << " completed resolve proxy hostname for: " << web.url << "\n"; (*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"; *m_ses.m_logger << time_now_string() << " on_proxy_name_lookup: " << e.message() << "\n";
#endif #endif