Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
78ca5491
Commit
78ca5491
authored
Feb 11, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/Interface: GetUpdateStamp() returns std::chrono::system_clock::time_point
parent
4146475c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
18 deletions
+19
-18
Stats.cxx
src/Stats.cxx
+4
-3
Interface.hxx
src/db/Interface.hxx
+3
-3
ProxyDatabasePlugin.cxx
src/db/plugins/ProxyDatabasePlugin.cxx
+4
-4
SimpleDatabasePlugin.cxx
src/db/plugins/simple/SimpleDatabasePlugin.cxx
+3
-3
SimpleDatabasePlugin.hxx
src/db/plugins/simple/SimpleDatabasePlugin.hxx
+3
-3
UpnpDatabasePlugin.cxx
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+2
-2
No files found.
src/Stats.cxx
View file @
78ca5491
...
...
@@ -28,6 +28,7 @@
#include "db/Stats.hxx"
#include "system/Clock.hxx"
#include "Log.hxx"
#include "util/ChronoUtil.hxx"
#include <chrono>
...
...
@@ -101,10 +102,10 @@ db_stats_print(Response &r, const Database &db)
stats
.
song_count
,
total_duration_s
);
const
time_t
update_stamp
=
db
.
GetUpdateStamp
();
if
(
update_stamp
>
0
)
const
auto
update_stamp
=
db
.
GetUpdateStamp
();
if
(
!
IsNegative
(
update_stamp
)
)
r
.
Format
(
"db_update: %lu
\n
"
,
(
unsigned
long
)
update_stamp
);
(
unsigned
long
)
std
::
chrono
::
system_clock
::
to_time_t
(
update_stamp
)
);
}
#endif
...
...
src/db/Interface.hxx
View file @
78ca5491
...
...
@@ -24,7 +24,7 @@
#include "tag/Type.h"
#include "Compiler.h"
#include <
time.h
>
#include <
chrono
>
struct
DatabasePlugin
;
struct
DatabaseStats
;
...
...
@@ -129,10 +129,10 @@ public:
/**
* Returns the time stamp of the last database update.
* Returns
0
if that is not not known/available.
* Returns
a negative value
if that is not not known/available.
*/
gcc_pure
virtual
time_
t
GetUpdateStamp
()
const
=
0
;
virtual
std
::
chrono
::
system_clock
::
time_poin
t
GetUpdateStamp
()
const
=
0
;
};
#endif
src/db/plugins/ProxyDatabasePlugin.cxx
View file @
78ca5491
...
...
@@ -89,7 +89,7 @@ class ProxyDatabase final : public Database, SocketMonitor, IdleMonitor {
struct
mpd_connection
*
connection
;
/* this is mutable because GetStats() must be "const" */
mutable
time_
t
update_stamp
;
mutable
std
::
chrono
::
system_clock
::
time_poin
t
update_stamp
;
/**
* The libmpdclient idle mask that was removed from the other
...
...
@@ -128,7 +128,7 @@ public:
unsigned
Update
(
const
char
*
uri_utf8
,
bool
discard
)
override
;
time_
t
GetUpdateStamp
()
const
override
{
std
::
chrono
::
system_clock
::
time_poin
t
GetUpdateStamp
()
const
override
{
return
update_stamp
;
}
...
...
@@ -347,7 +347,7 @@ ProxyDatabase::Create(EventLoop &loop, DatabaseListener &listener,
void
ProxyDatabase
::
Open
()
{
update_stamp
=
0
;
update_stamp
=
std
::
chrono
::
system_clock
::
time_point
::
min
()
;
try
{
Connect
();
...
...
@@ -818,7 +818,7 @@ ProxyDatabase::GetStats(const DatabaseSelection &selection) const
if
(
stats2
==
nullptr
)
ThrowError
(
connection
);
update_stamp
=
(
time_t
)
mpd_stats_get_db_update_time
(
stats2
);
update_stamp
=
std
::
chrono
::
system_clock
::
from_time_t
(
mpd_stats_get_db_update_time
(
stats2
)
);
DatabaseStats
stats
;
stats
.
song_count
=
mpd_stats_get_number_of_songs
(
stats2
);
...
...
src/db/plugins/simple/SimpleDatabasePlugin.cxx
View file @
78ca5491
...
...
@@ -157,7 +157,7 @@ SimpleDatabase::Load()
FileInfo
fi
;
if
(
GetFileInfo
(
path
,
fi
))
mtime
=
std
::
chrono
::
system_clock
::
to_time_t
(
fi
.
GetModificationTime
()
);
mtime
=
fi
.
GetModificationTime
(
);
}
void
...
...
@@ -166,7 +166,7 @@ SimpleDatabase::Open()
assert
(
prefixed_light_song
==
nullptr
);
root
=
Directory
::
NewRoot
();
mtime
=
0
;
mtime
=
std
::
chrono
::
system_clock
::
time_point
::
min
()
;
#ifndef NDEBUG
borrowed_song_count
=
0
;
...
...
@@ -358,7 +358,7 @@ SimpleDatabase::Save()
FileInfo
fi
;
if
(
GetFileInfo
(
path
,
fi
))
mtime
=
std
::
chrono
::
system_clock
::
to_time_t
(
fi
.
GetModificationTime
()
);
mtime
=
fi
.
GetModificationTime
(
);
}
void
...
...
src/db/plugins/simple/SimpleDatabasePlugin.hxx
View file @
78ca5491
...
...
@@ -50,7 +50,7 @@ class SimpleDatabase : public Database {
Directory
*
root
;
time_
t
mtime
;
std
::
chrono
::
system_clock
::
time_poin
t
mtime
;
/**
* A buffer for GetSong() when prefixing the #LightSong
...
...
@@ -88,7 +88,7 @@ public:
* Returns true if there is a valid database file on the disk.
*/
bool
FileExists
()
const
{
return
mtime
>
0
;
return
mtime
>
=
std
::
chrono
::
system_clock
::
time_point
(
std
::
chrono
::
system_clock
::
duration
::
zero
())
;
}
/**
...
...
@@ -125,7 +125,7 @@ public:
DatabaseStats
GetStats
(
const
DatabaseSelection
&
selection
)
const
override
;
time_
t
GetUpdateStamp
()
const
override
{
std
::
chrono
::
system_clock
::
time_poin
t
GetUpdateStamp
()
const
override
{
return
mtime
;
}
...
...
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
View file @
78ca5491
...
...
@@ -94,8 +94,8 @@ public:
DatabaseStats
GetStats
(
const
DatabaseSelection
&
selection
)
const
override
;
time_
t
GetUpdateStamp
()
const
override
{
return
0
;
std
::
chrono
::
system_clock
::
time_poin
t
GetUpdateStamp
()
const
override
{
return
std
::
chrono
::
system_clock
::
time_point
::
min
()
;
}
private
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment