[tracker/wip/carlosg/libtracker-common-cleanup: 6/6] libtracker-common: Drop unused date/time util functions




commit fc371eec6b6b94c07a5d9af2b14cb85df8c0bfa0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Sep 8 14:09:57 2020 +0200

    libtracker-common: Drop unused date/time util functions
    
    These are unused in the Tracker codebase.

 src/libtracker-common/tracker-date-time.c        | 24 ------------------
 src/libtracker-common/tracker-date-time.h        |  2 --
 tests/libtracker-common/tracker-date-time-test.c | 32 ------------------------
 3 files changed, 58 deletions(-)
---
diff --git a/src/libtracker-common/tracker-date-time.c b/src/libtracker-common/tracker-date-time.c
index 8370cfc0e..03ee078d5 100644
--- a/src/libtracker-common/tracker-date-time.c
+++ b/src/libtracker-common/tracker-date-time.c
@@ -349,27 +349,3 @@ tracker_date_time_get_offset (const GValue *value)
        /* UTC offset */
        return value->data[1].v_int;
 }
-
-gint
-tracker_date_time_get_local_date (const GValue *value)
-{
-       gdouble local_timestamp;
-
-       g_return_val_if_fail (G_VALUE_HOLDS (value, TRACKER_TYPE_DATE_TIME), 0);
-
-       /* return number of days since epoch */
-       local_timestamp = tracker_date_time_get_time (value) + tracker_date_time_get_offset (value);
-       return (gint) (local_timestamp / 3600 / 24);
-}
-
-gint
-tracker_date_time_get_local_time (const GValue *value)
-{
-       gdouble local_timestamp;
-
-       g_return_val_if_fail (G_VALUE_HOLDS (value, TRACKER_TYPE_DATE_TIME), 0);
-
-       /* return local time of day */
-       local_timestamp = tracker_date_time_get_time (value) + tracker_date_time_get_offset (value);
-       return (int) local_timestamp % (24 * 3600);
-}
diff --git a/src/libtracker-common/tracker-date-time.h b/src/libtracker-common/tracker-date-time.h
index df949e90e..cd3111b49 100644
--- a/src/libtracker-common/tracker-date-time.h
+++ b/src/libtracker-common/tracker-date-time.h
@@ -51,8 +51,6 @@ void     tracker_date_time_set_from_string     (GValue       *value,
                                                 GError      **error);
 gdouble  tracker_date_time_get_time            (const GValue *value);
 gint     tracker_date_time_get_offset          (const GValue *value);
-gint     tracker_date_time_get_local_date      (const GValue *value);
-gint     tracker_date_time_get_local_time      (const GValue *value);
 
 gdouble  tracker_string_to_date                (const gchar  *date_string,
                                                 gint         *offset,
diff --git a/tests/libtracker-common/tracker-date-time-test.c 
b/tests/libtracker-common/tracker-date-time-test.c
index 268cac58a..888269120 100644
--- a/tests/libtracker-common/tracker-date-time-test.c
+++ b/tests/libtracker-common/tracker-date-time-test.c
@@ -228,34 +228,6 @@ test_date_time_from_string ()
         error = NULL;
 }
 
-static void
-test_date_time_get_local_date ()
-{
-        GValue value = G_VALUE_INIT;
-        GError *error = NULL;
-
-        g_value_init (&value, TRACKER_TYPE_DATE_TIME);
-
-        tracker_date_time_set_from_string (&value, "2011-10-28T17:43:00+03:00", &error);
-        g_assert_true (!error);
-
-        g_assert_cmpint (tracker_date_time_get_local_date (&value), ==, 15275);
-}
-
-static void
-test_date_time_get_local_time ()
-{
-        GValue value = G_VALUE_INIT;
-        GError *error = NULL;
-
-        g_value_init (&value, TRACKER_TYPE_DATE_TIME);
-
-        tracker_date_time_set_from_string (&value, "2011-10-28T17:43:00+03:00", &error);
-        g_assert_true (!error);
-
-        g_assert_cmpint (tracker_date_time_get_local_time (&value), ==, 63780);
-}
-
 static void
 test_date_time_conversions (void)
 {
@@ -295,10 +267,6 @@ main (gint argc, gchar **argv)
                          test_date_time_get_set);
         g_test_add_func ("/libtracker-common/date-time/from_string",
                          test_date_time_from_string);
-        g_test_add_func ("/libtracker-common/date-time/get_local_date",
-                         test_date_time_get_local_date);
-        g_test_add_func ("/libtracker-common/date-time/get_local_time",
-                         test_date_time_get_local_time);
         g_test_add_func ("/libtracker-common/date-time/conversions",
                          test_date_time_conversions);
 


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