From 21792386d835903d2f9e2d04a1860d60bb8488e2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Aug 2012 09:15:34 +0200 Subject: time_print: new library, function time_print() Implements error checking for the gmtime_r() call, which was missing in two code locations. --- src/DatabasePrint.cxx | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'src/DatabasePrint.cxx') diff --git a/src/DatabasePrint.cxx b/src/DatabasePrint.cxx index 174ce1b70..843d218cb 100644 --- a/src/DatabasePrint.cxx +++ b/src/DatabasePrint.cxx @@ -27,6 +27,7 @@ extern "C" { #include "client.h" #include "song.h" #include "song_print.h" +#include "time_print.h" #include "playlist_vector.h" #include "tag.h" } @@ -105,21 +106,7 @@ PrintPlaylistFull(struct client *client, { print_playlist_in_directory(client, directory, playlist.name); -#ifndef G_OS_WIN32 - struct tm tm; -#endif - char timestamp[32]; - time_t t = playlist.mtime; - strftime(timestamp, sizeof(timestamp), -#ifdef G_OS_WIN32 - "%Y-%m-%dT%H:%M:%SZ", - gmtime(&t) -#else - "%FT%TZ", - gmtime_r(&t, &tm) -#endif - ); - client_printf(client, "Last-Modified: %s\n", timestamp); + time_print(client, "Last-Modified", playlist.mtime); return true; } -- cgit v1.2.3