Commit 249e8d59 authored by Max Kellermann's avatar Max Kellermann

Stats: use std::chrono

parent 8f4769d2
...@@ -29,12 +29,15 @@ ...@@ -29,12 +29,15 @@
#include "system/Clock.hxx" #include "system/Clock.hxx"
#include "Log.hxx" #include "Log.hxx"
#include <chrono>
#ifndef WIN32 #ifndef WIN32
/** /**
* The monotonic time stamp when MPD was started. It is used to * The monotonic time stamp when MPD was started. It is used to
* calculate the uptime. * 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 #endif
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
...@@ -114,7 +117,7 @@ stats_print(Response &r, const Partition &partition) ...@@ -114,7 +117,7 @@ stats_print(Response &r, const Partition &partition)
#ifdef WIN32 #ifdef WIN32
GetProcessUptimeS(), GetProcessUptimeS(),
#else #else
MonotonicClockS() - start_time, (unsigned)std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - start_time).count(),
#endif #endif
(unsigned long)(partition.pc.GetTotalPlayTime() + 0.5)); (unsigned long)(partition.pc.GetTotalPlayTime() + 0.5));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment