# HG changeset patch # User John Lindgren # Date 1240763553 14400 # Node ID be6c7aea8665a7284e5a9278653fbf1ac0a34464 # Parent 9501ad351ac0df7e472d093c02caf0d5ae5c3fea Use playlist_get_mtime, not plain stat, when sorting by date (bug #20) diff -r 9501ad351ac0 -r be6c7aea8665 src/audlegacy/playlist.c --- 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); }