summaryrefslogtreecommitdiff
path: root/src/db/update
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-02-11 22:47:05 +0100
committerMax Kellermann <max@musicpd.org>2017-02-11 23:45:15 +0100
commit6636c69a11e8b4d8aa079d86ef89fb8dbf96964e (patch)
treec12f3b7fc987ca4fe165603f7c333d2b09dfa46c /src/db/update
parent0ccaf4a1fff8933b28312d40ccf45a2a9fae2018 (diff)
storage/FileInfo: convert mtime to std::chrono::system_clock::time_point
Diffstat (limited to 'src/db/update')
-rw-r--r--src/db/update/Archive.cxx4
-rw-r--r--src/db/update/Container.cxx6
-rw-r--r--src/db/update/UpdateSong.cxx5
-rw-r--r--src/db/update/Walk.cxx4
4 files changed, 10 insertions, 9 deletions
diff --git a/src/db/update/Archive.cxx b/src/db/update/Archive.cxx
index 6004ed835..d6fb77d21 100644
--- a/src/db/update/Archive.cxx
+++ b/src/db/update/Archive.cxx
@@ -137,7 +137,7 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
{
Directory *directory = LockFindChild(parent, name);
- if (directory != nullptr && directory->mtime == info.mtime &&
+ if (directory != nullptr && directory->mtime == std::chrono::system_clock::to_time_t(info.mtime) &&
!walk_discard)
/* MPD has already scanned the archive, and it hasn't
changed since - don't consider updating it */
@@ -173,7 +173,7 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
directory->device = DEVICE_INARCHIVE;
}
- directory->mtime = info.mtime;
+ directory->mtime = std::chrono::system_clock::to_time_t(info.mtime);
UpdateArchiveVisitor visitor(*this, *file, directory);
file->Visit(visitor);
diff --git a/src/db/update/Container.cxx b/src/db/update/Container.cxx
index fc4ec416c..6069b172b 100644
--- a/src/db/update/Container.cxx
+++ b/src/db/update/Container.cxx
@@ -43,7 +43,7 @@ UpdateWalk::MakeDirectoryIfModified(Directory &parent, const char *name,
if (directory->IsMount())
return nullptr;
- if (directory->mtime == info.mtime && !walk_discard) {
+ if (directory->mtime == std::chrono::system_clock::to_time_t(info.mtime) && !walk_discard) {
/* not modified */
return nullptr;
}
@@ -53,7 +53,7 @@ UpdateWalk::MakeDirectoryIfModified(Directory &parent, const char *name,
}
directory = parent.MakeChild(name);
- directory->mtime = info.mtime;
+ directory->mtime = std::chrono::system_clock::to_time_t(info.mtime);
return directory;
}
@@ -107,7 +107,7 @@ UpdateWalk::UpdateContainerFile(Directory &directory,
*contdir);
// shouldn't be necessary but it's there..
- song->mtime = info.mtime;
+ song->mtime = std::chrono::system_clock::to_time_t(info.mtime);
FormatDefault(update_domain, "added %s/%s",
contdir->GetPath(), song->uri);
diff --git a/src/db/update/UpdateSong.cxx b/src/db/update/UpdateSong.cxx
index 2249f3d8b..6d3802069 100644
--- a/src/db/update/UpdateSong.cxx
+++ b/src/db/update/UpdateSong.cxx
@@ -51,7 +51,8 @@ UpdateWalk::UpdateSongFile2(Directory &directory,
return;
}
- if (!(song != nullptr && info.mtime == song->mtime &&
+ if (!(song != nullptr &&
+ std::chrono::system_clock::to_time_t(info.mtime) == song->mtime &&
!walk_discard) &&
UpdateContainerFile(directory, name, suffix, info)) {
if (song != nullptr)
@@ -79,7 +80,7 @@ UpdateWalk::UpdateSongFile2(Directory &directory,
modified = true;
FormatDefault(update_domain, "added %s/%s",
directory.GetPath(), name);
- } else if (info.mtime != song->mtime || walk_discard) {
+ } else if (std::chrono::system_clock::to_time_t(info.mtime) != song->mtime || walk_discard) {
FormatDefault(update_domain, "updating %s/%s",
directory.GetPath(), name);
if (!song->UpdateFile(storage)) {
diff --git a/src/db/update/Walk.cxx b/src/db/update/Walk.cxx
index 2e917037d..fc3497b3a 100644
--- a/src/db/update/Walk.cxx
+++ b/src/db/update/Walk.cxx
@@ -192,7 +192,7 @@ UpdateWalk::UpdatePlaylistFile(Directory &directory,
if (!playlist_suffix_supported(suffix))
return false;
- PlaylistInfo pi(name, info.mtime);
+ PlaylistInfo pi(name, std::chrono::system_clock::to_time_t(info.mtime));
const ScopeDatabaseLock protect;
if (directory.playlists.UpdateOrInsert(std::move(pi)))
@@ -382,7 +382,7 @@ UpdateWalk::UpdateDirectory(Directory &directory,
UpdateDirectoryChild(directory, child_exclude_list, name_utf8, info2);
}
- directory.mtime = info.mtime;
+ directory.mtime = std::chrono::system_clock::to_time_t(info.mtime);
return true;
}