* Minor *BSD compatibility fixes.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@631 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-02-04 20:00:54 +00:00
parent 68502367ec
commit 8b934623d4
2 changed files with 9 additions and 4 deletions
+7 -2
View File
@@ -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);