From: Max Kellermann Date: Wed, 8 Jul 2009 21:07:22 +0000 (+0200) Subject: screen_play: moved g_strdup_printf() call to format_duration() X-Git-Tag: release-0.15~44 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f86f1ade695b353229f3dec702b717b3a8417e99;p=ncmpc.git screen_play: moved g_strdup_printf() call to format_duration() --- 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) {