From 249e8d59cb61e53e517706bfc119d04e590fab13 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 28 Dec 2016 10:20:29 +0100 Subject: [PATCH] Stats: use std::chrono --- src/Stats.cxx | 7 +++++-- 1 file 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 + #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::steady_clock::now() - start_time).count(), #endif (unsigned long)(partition.pc.GetTotalPlayTime() + 0.5));