[rygel/rygel-0-10: 6/8] core: Properly sort on dates without time



commit 4c99f5f964fc0fb62ad7e0ebd6b6097dc6a3319c
Author: Jens Georg <mail jensge org>
Date:   Fri May 27 10:05:38 2011 +0200

    core: Properly sort on dates without time
    
    The implementation in glib was returning an empty timeval if there was
    no time attached to the date

 src/rygel/rygel-media-item.vala |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala
index d4676cb..f714877 100644
--- a/src/rygel/rygel-media-item.vala
+++ b/src/rygel/rygel-media-item.vala
@@ -290,6 +290,17 @@ public abstract class Rygel.MediaItem : MediaObject {
         } else if (item.date == null) {
             return 1;
         } else {
+            var our_date = this.date;
+            var other_date = item.date;
+
+            if (!our_date.contains ("T")) {
+                our_date += "T00:00:00Z";
+            }
+
+            if (!other_date.contains ("T")) {
+                other_date += "T00:00:00Z";
+            }
+
             var tv1 = TimeVal ();
             assert (tv1.from_iso8601 (this.date));
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]