Commit fefdaa1e authored by Ivan Frade's avatar Ivan Frade Committed by Jürg Billeter

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.
parent 6d75067b
......@@ -807,44 +807,6 @@ tracker_date_guess (const gchar *date_string)
return NULL;
}
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);
}
......
......@@ -77,9 +77,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_cmpstr (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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment