diff --git a/src/misc.cpp b/src/misc.cpp index 2f0bcf34f..c88724f5f 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -724,14 +724,6 @@ QString misc::magnetUriToHash(QString magnet_uri) { return hash; } -QString misc::time_tToQString(const boost::optional &t) { - if(!t.is_initialized() || *t < 0) return tr("Unknown"); - QDateTime dt = QDateTime::fromTime_t(*t); - if(dt.isNull() || !dt.isValid()) - return tr("Unknown"); - return dt.toString(Qt::DefaultLocaleLongDate); -} - // Replace ~ in path QString misc::expandPath(QString path) { path = path.trimmed(); diff --git a/src/misc.h b/src/misc.h index 39b1c5788..53fc1f762 100644 --- a/src/misc.h +++ b/src/misc.h @@ -132,7 +132,6 @@ public: static QString magnetUriToName(QString magnet_uri); static QString magnetUriToHash(QString magnet_uri); static QString bcLinkToMagnet(QString bc_link); - static QString time_tToQString(const boost::optional &t); // Replace ~ in path static QString expandPath(QString path); // Take a number of seconds and return an user-friendly diff --git a/src/qtlibtorrent/qtorrenthandle.cpp b/src/qtlibtorrent/qtorrenthandle.cpp index a31897cb3..a2c859f85 100644 --- a/src/qtlibtorrent/qtorrenthandle.cpp +++ b/src/qtlibtorrent/qtorrenthandle.cpp @@ -72,7 +72,9 @@ QString QTorrentHandle::name() const { QString QTorrentHandle::creation_date() const { #if LIBTORRENT_VERSION_MINOR > 15 boost::optional t = torrent_handle::get_torrent_info().creation_date(); - return misc::time_tToQString(t); + if (t) + return QDateTime::fromTime_t(*t).toString(Qt::DefaultLocaleLongDate); + return tr("Unknown"); #else boost::optional boostDate = torrent_handle::get_torrent_info().creation_date(); return misc::boostTimeToQString(boostDate);