From f86f1ade695b353229f3dec702b717b3a8417e99 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Jul 2009 23:07:22 +0200 Subject: [PATCH] screen_play: moved g_strdup_printf() call to format_duration() --- src/screen_play.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/screen_play.c b/src/screen_play.c index 23ba656..f41f32a 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -96,6 +96,12 @@ playlist_changed_callback(mpdclient_t *c, int event, gpointer data) playlist_repaint_if_active(); } +static char * +format_duration(int duration) +{ + return g_strdup_printf("%d:%02d", duration / 60, duration % 60); +} + static const char * list_callback(unsigned idx, bool *highlight, char **second_column, G_GNUC_UNUSED void *data) { @@ -116,7 +122,7 @@ list_callback(unsigned idx, bool *highlight, char **second_column, G_GNUC_UNUSED #ifndef NCMPC_MINI if(second_column) - *second_column = g_strdup_printf("%d:%02d", song->time/60, song->time%60); + *second_column = format_duration(song->time); if ((unsigned)song->pos == lw->selected) { -- 2.39.5