mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 06:02:31 +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
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user