summaryrefslogtreecommitdiff
path: root/src/SongSave.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2017-01-18 13:19:13 +0100
committerMax Kellermann <max@musicpd.org>2017-08-18 12:22:47 +0200
commitb886dfae4d4a4d5ca49fd1323e18bae0e78dfab1 (patch)
treedae868d33c44c9c411d6ab7d94b1738f13dd7d37 /src/SongSave.cxx
parent902fbb33471b07c3ab9bf62d13927f2db46e35f5 (diff)
DetachedSong, db/LightSong, db/simple/Song: use std::chrono::system_clock::time_point
Diffstat (limited to 'src/SongSave.cxx')
-rw-r--r--src/SongSave.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/SongSave.cxx b/src/SongSave.cxx
index f551b7670..eadb0c254 100644
--- a/src/SongSave.cxx
+++ b/src/SongSave.cxx
@@ -27,6 +27,7 @@
#include "tag/ParseName.hxx"
#include "tag/Tag.hxx"
#include "tag/Builder.hxx"
+#include "util/ChronoUtil.hxx"
#include "util/StringStrip.hxx"
#include "util/RuntimeError.hxx"
@@ -54,7 +55,9 @@ song_save(BufferedOutputStream &os, const Song &song)
tag_save(os, song.tag);
- os.Format(SONG_MTIME ": %li\n", (long)song.mtime);
+ if (!IsNegative(song.mtime))
+ os.Format(SONG_MTIME ": %li\n",
+ (long)std::chrono::system_clock::to_time_t(song.mtime));
os.Format(SONG_END "\n");
}
@@ -67,7 +70,9 @@ song_save(BufferedOutputStream &os, const DetachedSong &song)
tag_save(os, song.GetTag());
- os.Format(SONG_MTIME ": %li\n", (long)song.GetLastModified());
+ if (!IsNegative(song.GetLastModified()))
+ os.Format(SONG_MTIME ": %li\n",
+ (long)std::chrono::system_clock::to_time_t(song.GetLastModified()));
os.Format(SONG_END "\n");
}
@@ -99,7 +104,7 @@ song_load(TextFile &file, const char *uri)
} else if (strcmp(line, "Playlist") == 0) {
tag.SetHasPlaylist(strcmp(value, "yes") == 0);
} else if (strcmp(line, SONG_MTIME) == 0) {
- song->SetLastModified(atoi(value));
+ song->SetLastModified(std::chrono::system_clock::from_time_t(atoi(value)));
} else if (strcmp(line, "Range") == 0) {
char *endptr;