[tracker/tracker-0.10] libtracker-extract: Accept ISO8601 dates with milliseconds



commit ab6afebe6ed20406fadf777639606be9936e8677
Author: Ivan Frade <ivan frade gmail com>
Date:   Wed Nov 9 17:21:54 2011 +0200

    libtracker-extract: Accept ISO8601 dates with milliseconds
    
    Milliseconds were removed in a special case. Not needed anymore, because
    now we want milliseconds in the dates.

 src/libtracker-extract/tracker-utils.c        |   40 +------------------------
 tests/libtracker-extract/tracker-test-utils.c |    5 ++-
 2 files changed, 5 insertions(+), 40 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-utils.c b/src/libtracker-extract/tracker-utils.c
index f1331a4..55122b8 100644
--- a/src/libtracker-extract/tracker-utils.c
+++ b/src/libtracker-extract/tracker-utils.c
@@ -808,45 +808,7 @@ tracker_date_guess (const gchar *date_string)
 		}
 
 		return g_strdup (buf);
-	} else if ((len == 28) && (date_string[4] == '-') && (date_string[10] == 'T')
-	           && (date_string[19] == '.') ) {
-		/* The fraction of seconds ISO 8601 "YYYY-MM-DDThh:mm:ss.ff+zz:zz" */
-		buf[0] = date_string[0];
-		buf[1] = date_string[1];
-		buf[2] = date_string[2];
-		buf[3] = date_string[3];
-		buf[4] = '-';
-		buf[5] = date_string[5];
-		buf[6] = date_string[6];
-		buf[7] = '-';
-		buf[8] = date_string[8];
-		buf[9] = date_string[9];
-		buf[10] = 'T';
-		buf[11] = date_string[11];
-		buf[12] = date_string[12];
-		buf[13] = ':';
-		buf[14] = date_string[14];
-		buf[15] = date_string[15];
-		buf[16] = ':';
-		buf[17] = date_string[17];
-		buf[18] = date_string[18];
-		buf[19] = date_string[22];
-		buf[20] = date_string[23];
-		buf[21] = date_string[24];
-		buf[22] = ':';
-		buf[23] = date_string[26];
-		buf[24] = date_string[27];
-		buf[25] = '\0';
-
-		tracker_string_to_date (buf, NULL, &error);
-
-		if (error != NULL) {
-			g_error_free (error);
-			return NULL;
-		}
-
-		return g_strdup (buf);
-	}
+	} 
 
 	tracker_string_to_date (date_string, NULL, &error);
 
diff --git a/tests/libtracker-extract/tracker-test-utils.c b/tests/libtracker-extract/tracker-test-utils.c
index 2a2d9a5..77726aa 100644
--- a/tests/libtracker-extract/tracker-test-utils.c
+++ b/tests/libtracker-extract/tracker-test-utils.c
@@ -79,9 +79,12 @@ test_guess_date (void)
 
         /* "YYYY-MM-DDThh:mm:ss.ff+zz:zz" */
         result = tracker_date_guess ("2010-03-18T01:02:03.10-00:03");
-        g_assert (tracker_test_helpers_cmpstr_equal (result, "2010-03-18T01:02:03-00:03"));
+        g_assert_cmpstr (result, ==, "2010-03-18T01:02:03.10-00:03");
         g_free (result);
 
+        result = tracker_date_guess ("2010-03-18T01:02:03.100");
+        g_assert_cmpstr (result, ==, "2010-03-18T01:02:03.100");
+        g_free (result);
 
 	if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
 		result = tracker_date_guess (NULL);



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