aboutsummaryrefslogtreecommitdiffstats
path: root/src/song_print.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-08 09:15:34 +0200
committerMax Kellermann <max@duempel.org>2012-08-08 09:27:12 +0200
commit21792386d835903d2f9e2d04a1860d60bb8488e2 (patch)
tree572cd68b4684b0a03207907dfc96a5c5e2651aa2 /src/song_print.c
parent63a2ac21e1d8190448057fbf24d5ab948d3daff8 (diff)
downloadmpd-21792386d835903d2f9e2d04a1860d60bb8488e2.tar.gz
mpd-21792386d835903d2f9e2d04a1860d60bb8488e2.tar.xz
mpd-21792386d835903d2f9e2d04a1860d60bb8488e2.zip
time_print: new library, function time_print()
Implements error checking for the gmtime_r() call, which was missing in two code locations.
Diffstat (limited to 'src/song_print.c')
-rw-r--r--src/song_print.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/song_print.c b/src/song_print.c
index fb608a8b2..d876b85a8 100644
--- a/src/song_print.c
+++ b/src/song_print.c
@@ -19,6 +19,7 @@
#include "config.h"
#include "song_print.h"
+#include "time_print.h"
#include "song.h"
#include "directory.h"
#include "tag_print.h"
@@ -63,32 +64,8 @@ song_print_info(struct client *client, struct song *song)
song->start_ms / 1000,
song->start_ms % 1000);
- if (song->mtime > 0) {
-#ifndef G_OS_WIN32
- struct tm tm;
-#endif
- const struct tm *tm2;
-
-#ifdef G_OS_WIN32
- tm2 = gmtime(&song->mtime);
-#else
- tm2 = gmtime_r(&song->mtime, &tm);
-#endif
-
- if (tm2 != NULL) {
- char timestamp[32];
-
- strftime(timestamp, sizeof(timestamp),
-#ifdef G_OS_WIN32
- "%Y-%m-%dT%H:%M:%SZ",
-#else
- "%FT%TZ",
-#endif
- tm2);
- client_printf(client, "Last-Modified: %s\n",
- timestamp);
- }
- }
+ if (song->mtime > 0)
+ time_print(client, "Last-Modified", song->mtime);
if (song->tag)
tag_print(client, song->tag);