2012-08-14 19:02:26 +02:00
|
|
|
/*
|
2021-01-01 19:54:25 +01:00
|
|
|
* Copyright 2003-2021 The Music Player Daemon Project
|
2012-08-14 19:02:26 +02:00
|
|
|
* http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2013-10-15 09:38:12 +02:00
|
|
|
#include "Clock.hxx"
|
2012-08-14 19:02:26 +02:00
|
|
|
|
2017-12-12 10:22:20 +01:00
|
|
|
#ifdef _WIN32
|
2019-05-08 15:47:04 +02:00
|
|
|
#include "time/FileTime.hxx"
|
2013-11-24 20:41:00 +01:00
|
|
|
|
2019-05-08 15:47:04 +02:00
|
|
|
#include <windows.h>
|
2013-11-24 20:41:00 +01:00
|
|
|
|
2019-05-08 15:42:47 +02:00
|
|
|
std::chrono::seconds
|
2013-11-24 20:41:00 +01:00
|
|
|
GetProcessUptimeS()
|
|
|
|
{
|
2013-11-29 10:21:31 +01:00
|
|
|
FILETIME creation_time, exit_time, kernel_time, user_time, now;
|
2013-11-24 20:41:00 +01:00
|
|
|
GetProcessTimes(GetCurrentProcess(), &creation_time,
|
2013-11-29 10:21:31 +01:00
|
|
|
&exit_time, &kernel_time, &user_time);
|
2013-11-24 20:41:00 +01:00
|
|
|
GetSystemTimeAsFileTime(&now);
|
|
|
|
|
|
|
|
return DeltaFileTimeS(now, creation_time);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|