summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/contacts/common/util/DateUtils.java21
-rw-r--r--tests/src/com/android/contacts/common/util/DateUtilTests.java62
2 files changed, 0 insertions, 83 deletions
diff --git a/src/com/android/contacts/common/util/DateUtils.java b/src/com/android/contacts/common/util/DateUtils.java
index c695ec66d..097230ca9 100644
--- a/src/com/android/contacts/common/util/DateUtils.java
+++ b/src/com/android/contacts/common/util/DateUtils.java
@@ -18,8 +18,6 @@ package com.android.contacts.common.util;
import android.content.Context;
import android.text.format.DateFormat;
-import android.text.format.Time;
-
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
@@ -269,23 +267,4 @@ public class DateUtils {
}
return anniversary.getTime();
}
-
- /**
- * Determine the difference, in days between two dates. Uses similar logic as the
- * {@link android.text.format.DateUtils.getRelativeTimeSpanString} method.
- *
- * @param time Instance of time object to use for calculations.
- * @param date1 First date to check.
- * @param date2 Second date to check.
- * @return The absolute difference in days between the two dates.
- */
- public static int getDayDifference(Time time, long date1, long date2) {
- time.set(date1);
- int startDay = Time.getJulianDay(date1, time.gmtoff);
-
- time.set(date2);
- int currentDay = Time.getJulianDay(date2, time.gmtoff);
-
- return Math.abs(currentDay - startDay);
- }
}
diff --git a/tests/src/com/android/contacts/common/util/DateUtilTests.java b/tests/src/com/android/contacts/common/util/DateUtilTests.java
deleted file mode 100644
index f4602892d..000000000
--- a/tests/src/com/android/contacts/common/util/DateUtilTests.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.contacts.common.util;
-
-import junit.framework.TestCase;
-
-import android.test.suitebuilder.annotation.SmallTest;
-import android.text.format.Time;
-
-/**
- * Unit tests for {@link com.android.contacts.common.util.DateUtils}.
- */
-@SmallTest
-public class DateUtilTests extends TestCase {
-
- /**
- * Test date differences which are in the same day.
- */
- public void testDayDiffNone() {
- Time time = new Time();
- long date1 = System.currentTimeMillis();
- long date2 = System.currentTimeMillis() + android.text.format.DateUtils.HOUR_IN_MILLIS;
- assertEquals(0, DateUtils.getDayDifference(time, date1, date2));
- assertEquals(0, DateUtils.getDayDifference(time, date2, date1));
- }
-
- /**
- * Test date differences which are a day apart.
- */
- public void testDayDiffOne() {
- Time time = new Time();
- long date1 = System.currentTimeMillis();
- long date2 = date1 + android.text.format.DateUtils.DAY_IN_MILLIS;
- assertEquals(1, DateUtils.getDayDifference(time, date1, date2));
- assertEquals(1, DateUtils.getDayDifference(time, date2, date1));
- }
-
- /**
- * Test date differences which are two days apart.
- */
- public void testDayDiffTwo() {
- Time time = new Time();
- long date1 = System.currentTimeMillis();
- long date2 = date1 + 2*android.text.format.DateUtils.DAY_IN_MILLIS;
- assertEquals(2, DateUtils.getDayDifference(time, date1, date2));
- assertEquals(2, DateUtils.getDayDifference(time, date2, date1));
- }
-}