Mercurial > audlegacy
changeset 4873:be6c7aea8665
Use playlist_get_mtime, not plain stat, when sorting by date (bug #20)
author | John Lindgren <john.lindgren@tds.net> |
---|---|
date | Sun, 26 Apr 2009 12:32:33 -0400 |
parents | 9501ad351ac0 |
children | 43eb8388760d |
files | src/audlegacy/playlist.c |
diffstat | 1 files changed, 8 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audlegacy/playlist.c Sun Apr 26 04:34:53 2009 -0400 +++ b/src/audlegacy/playlist.c Sun Apr 26 12:32:33 2009 -0400 @@ -2180,25 +2180,14 @@ playlist_compare_date(PlaylistEntry * a, PlaylistEntry * b) { - struct stat buf; - time_t modtime; - - if (stat(a->filename, &buf) == 0) { - modtime = buf.st_mtime; - - if (stat(b->filename, &buf) == 0) { - if (buf.st_mtime == modtime) - return 0; - else - return (buf.st_mtime - modtime) > 0 ? -1 : 1; - } - else - return -1; - } - else if (!lstat(b->filename, &buf)) - return 1; - else - return playlist_compare_filename(a, b); + time_t a_time, b_time; + a_time = playlist_get_mtime (a->filename); + b_time = playlist_get_mtime (b->filename); + if (a_time < b_time) + return -1; + if (a_time > b_time) + return 1; + return playlist_compare_filename (a, b); }