mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-16 06:06:16 +00:00
* Minor *BSD compatibility fixes.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@631 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -139,6 +139,7 @@ CommandScheduler::parse(const std::string& arg) {
|
|||||||
uint32_t
|
uint32_t
|
||||||
CommandScheduler::parse_absolute(const char* str) {
|
CommandScheduler::parse_absolute(const char* str) {
|
||||||
Time result = parse_time(str);
|
Time result = parse_time(str);
|
||||||
|
time_t t;
|
||||||
|
|
||||||
// Do the local time thing.
|
// Do the local time thing.
|
||||||
struct tm local;
|
struct tm local;
|
||||||
@@ -148,13 +149,17 @@ CommandScheduler::parse_absolute(const char* str) {
|
|||||||
return result.second;
|
return result.second;
|
||||||
|
|
||||||
case 2:
|
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.");
|
throw torrent::input_error("Could not convert unix time to local time.");
|
||||||
|
|
||||||
return (result.second + 3600 - 60 * local.tm_min - local.tm_sec) % 3600;
|
return (result.second + 3600 - 60 * local.tm_min - local.tm_sec) % 3600;
|
||||||
|
|
||||||
case 3:
|
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.");
|
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);
|
return (result.second + 24 * 3600 - 3600 * local.tm_hour - 60 * local.tm_min - local.tm_sec) % (24 * 3600);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "variable_generic.h"
|
#include "variable_generic.h"
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ VariableValue::set(const torrent::Bencode& arg) {
|
|||||||
|
|
||||||
case torrent::Bencode::TYPE_STRING:
|
case torrent::Bencode::TYPE_STRING:
|
||||||
first = arg.as_string().c_str();
|
first = arg.as_string().c_str();
|
||||||
value = std::strtoll(first, &last, 0);
|
value = strtoll(first, &last, 0);
|
||||||
|
|
||||||
if (last == first || *last != '\0')
|
if (last == first || *last != '\0')
|
||||||
throw torrent::input_error("Could not convert string to value.");
|
throw torrent::input_error("Could not convert string to value.");
|
||||||
|
|||||||
Reference in New Issue
Block a user