summaryrefslogtreecommitdiff
path: root/src/Stats.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-12-28 10:20:29 +0100
committerMax Kellermann <max@musicpd.org>2016-12-28 10:22:55 +0100
commit249e8d59cb61e53e517706bfc119d04e590fab13 (patch)
tree4e5d75be9d2f6f8b2f1b377ec995028608da0ba2 /src/Stats.cxx
parent8f4769d2acc46c5ef51ab376c7c0469364f7d095 (diff)
Stats: use std::chrono
Diffstat (limited to 'src/Stats.cxx')
-rw-r--r--src/Stats.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Stats.cxx b/src/Stats.cxx
index 29f1c3f77..9ab886778 100644
--- a/src/Stats.cxx
+++ b/src/Stats.cxx
@@ -29,12 +29,15 @@
#include "system/Clock.hxx"
#include "Log.hxx"
+#include <chrono>
+
#ifndef WIN32
/**
* The monotonic time stamp when MPD was started. It is used to
* calculate the uptime.
*/
-static const unsigned start_time = MonotonicClockS();
+static const std::chrono::steady_clock::time_point start_time =
+ std::chrono::steady_clock::now();
#endif
#ifdef ENABLE_DATABASE
@@ -114,7 +117,7 @@ stats_print(Response &r, const Partition &partition)
#ifdef WIN32
GetProcessUptimeS(),
#else
- MonotonicClockS() - start_time,
+ (unsigned)std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - start_time).count(),
#endif
(unsigned long)(partition.pc.GetTotalPlayTime() + 0.5));