From 8b934623d49b8806141bac857b6f078fa110f81d Mon Sep 17 00:00:00 2001 From: rakshasa Date: Sat, 4 Feb 2006 20:00:54 +0000 Subject: [PATCH] * Minor *BSD compatibility fixes. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@631 e378c898-3ddf-0310-93e7-cc216c733640 --- src/command_scheduler.cc | 9 +++++++-- src/utils/variable_generic.cc | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/command_scheduler.cc b/src/command_scheduler.cc index c7536203..969c0444 100644 --- a/src/command_scheduler.cc +++ b/src/command_scheduler.cc @@ -139,6 +139,7 @@ CommandScheduler::parse(const std::string& arg) { uint32_t CommandScheduler::parse_absolute(const char* str) { Time result = parse_time(str); + time_t t; // Do the local time thing. struct tm local; @@ -148,13 +149,17 @@ CommandScheduler::parse_absolute(const char* str) { return result.second; case 2: - if (localtime_r(&cachedTime.tval().tv_sec, &local) == NULL) + t = cachedTime.tval().tv_sec; + + if (localtime_r(&t, &local) == NULL) throw torrent::input_error("Could not convert unix time to local time."); return (result.second + 3600 - 60 * local.tm_min - local.tm_sec) % 3600; case 3: - if (localtime_r(&cachedTime.tval().tv_sec, &local) == NULL) + t = cachedTime.tval().tv_sec; + + if (localtime_r(&t, &local) == NULL) throw torrent::input_error("Could not convert unix time to local time."); return (result.second + 24 * 3600 - 3600 * local.tm_hour - 60 * local.tm_min - local.tm_sec) % (24 * 3600); diff --git a/src/utils/variable_generic.cc b/src/utils/variable_generic.cc index 7bfbc61c..d7edf5a8 100644 --- a/src/utils/variable_generic.cc +++ b/src/utils/variable_generic.cc @@ -36,7 +36,7 @@ #include "config.h" -#include +#include #include "variable_generic.h" @@ -80,7 +80,7 @@ VariableValue::set(const torrent::Bencode& arg) { case torrent::Bencode::TYPE_STRING: first = arg.as_string().c_str(); - value = std::strtoll(first, &last, 0); + value = strtoll(first, &last, 0); if (last == first || *last != '\0') throw torrent::input_error("Could not convert string to value.");