deprecate use of boost.date_time. use boost.chrono instead

This commit is contained in:
Arvid Norberg 2015-04-25 01:40:39 +00:00
parent 3bf9fa8fca
commit 8e08cd7639
2 changed files with 21 additions and 11 deletions

View File

@ -39,11 +39,15 @@ POSSIBILITY OF SUCH DAMAGE.
#include <set>
#include <boost/assert.hpp>
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/cstdint.hpp>
#ifndef TORRENT_NO_DEPRECATE
// for deprecated force_reannounce
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/peer_id.hpp"
@ -1331,13 +1335,17 @@ namespace libtorrent
// ``torrent_handle::query_torrent_file``.
boost::weak_ptr<const torrent_info> torrent_file;
// TODO: 3 don't use boost.date-time types here. use chrono types
// the time until the torrent will announce itself to the tracker.
boost::posix_time::time_duration next_announce;
time_duration next_announce;
#ifdef TORRENT_NO_DEPRECATE
// the time the tracker want us to wait until we announce ourself
// again the next time.
boost::posix_time::time_duration announce_interval;
time_duration announce_interval;
#else
// leave this here for ABI stability
time_duration deprecated_announce_interval_;
#endif
// the URL of the last working tracker. If no tracker request has
// been successful yet, it's set to an empty string.

View File

@ -11432,21 +11432,23 @@ namespace libtorrent
st->upload_payload_rate = m_stat.upload_payload_rate();
if (m_waiting_tracker && !is_paused())
st->next_announce = boost::posix_time::seconds(
total_seconds(next_announce() - now));
st->next_announce = next_announce() - now;
else
st->next_announce = boost::posix_time::seconds(0);
st->next_announce = seconds(0);
if (st->next_announce.is_negative())
st->next_announce = boost::posix_time::seconds(0);
if (st->next_announce.count() < 0)
st->next_announce = seconds(0);
st->announce_interval = boost::posix_time::seconds(0);
#ifdef TORRENT_NO_DEPRECATE
st->announce_interval = seconds(0);
#endif
st->current_tracker.clear();
if (m_last_working_tracker >= 0)
{
TORRENT_ASSERT(m_last_working_tracker < int(m_trackers.size()));
st->current_tracker = m_trackers[m_last_working_tracker].url;
const int i = m_last_working_tracker;
st->current_tracker = m_trackers[i].url;
}
else
{