aboutsummaryrefslogtreecommitdiffstats
path: root/src/db/upnp/Discovery.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-18 16:26:11 +0100
committerMax Kellermann <max@duempel.org>2014-01-18 16:26:11 +0100
commit051eede1edda157f7354c9ad468e8884a8987979 (patch)
tree292b196b5cd09a3943542ec57d4aa240a4cc2fff /src/db/upnp/Discovery.hxx
parent0696cac50bfc9430e5094112dc5019be70998012 (diff)
downloadmpd-051eede1edda157f7354c9ad468e8884a8987979.tar.gz
mpd-051eede1edda157f7354c9ad468e8884a8987979.tar.xz
mpd-051eede1edda157f7354c9ad468e8884a8987979.zip
db/upnp/Discovery: use monotonic clock instead of time()
Diffstat (limited to '')
-rw-r--r--src/db/upnp/Discovery.hxx21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/db/upnp/Discovery.hxx b/src/db/upnp/Discovery.hxx
index d1df9f666..cda78cff5 100644
--- a/src/db/upnp/Discovery.hxx
+++ b/src/db/upnp/Discovery.hxx
@@ -31,8 +31,6 @@
#include <vector>
#include <string>
-#include <time.h>
-
class LibUPnP;
class ContentDirectoryService;
@@ -51,7 +49,7 @@ class UPnPDeviceDirectory {
struct DiscoveredTask {
std::string url;
std::string deviceId;
- int expires; // Seconds valid
+ unsigned expires; // Seconds valid
DiscoveredTask(const Upnp_Discovery *disco)
:url(disco->Location),
@@ -66,12 +64,18 @@ class UPnPDeviceDirectory {
class ContentDirectoryDescriptor {
public:
UPnPDevice device;
- time_t last_seen;
- int expires; // seconds valid
+
+ /**
+ * The MonotonicClockS() time stamp when this device
+ * was last seen alive.
+ */
+ unsigned last_seen;
+
+ unsigned expires; // seconds valid
ContentDirectoryDescriptor() = default;
- ContentDirectoryDescriptor(time_t last, int exp)
+ ContentDirectoryDescriptor(unsigned last, int exp)
:last_seen(last), expires(exp+20) {}
bool Parse(const std::string &url, const char *description,
@@ -93,7 +97,10 @@ class UPnPDeviceDirectory {
*/
int m_searchTimeout;
- time_t m_lastSearch;
+ /**
+ * The MonotonicClockS() time stamp of the last search.
+ */
+ unsigned m_lastSearch;
public:
UPnPDeviceDirectory(LibUPnP *_lib);