diff options
-rw-r--r-- | src/main/java/com/gitblit/utils/TimeUtils.java | 10 | ||||
-rw-r--r-- | src/test/java/com/gitblit/tests/GitBlitSuite.java | 1 | ||||
-rw-r--r-- | src/test/java/com/gitblit/utils/TimeUtilsTest.java (renamed from src/test/java/com/gitblit/tests/TimeUtilsTest.java) | 7 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/com/gitblit/utils/TimeUtils.java b/src/main/java/com/gitblit/utils/TimeUtils.java index 001e6be6..12737047 100644 --- a/src/main/java/com/gitblit/utils/TimeUtils.java +++ b/src/main/java/com/gitblit/utils/TimeUtils.java @@ -63,7 +63,7 @@ public class TimeUtils { }
- public static boolean isToday(Date date, TimeZone timezone, Date now) {
+ static boolean isToday(Date date, TimeZone timezone, Date now) {
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
if (timezone != null) {
df.setTimeZone(timezone);
@@ -82,7 +82,7 @@ public class TimeUtils { }
- public static boolean isYesterday(Date date, TimeZone timezone, Date now) {
+ static boolean isYesterday(Date date, TimeZone timezone, Date now) {
Calendar cal = Calendar.getInstance();
cal.setTime(now);
cal.add(Calendar.DATE, -1);
@@ -170,7 +170,7 @@ public class TimeUtils { }
- public static int hoursAgo(Date date, long now, boolean roundup) {
+ static int hoursAgo(Date date, long now, boolean roundup) {
long diff = now - date.getTime();
int hours = (int) (diff / ONEHOUR);
if (roundup && (diff % ONEHOUR) >= HALFHOUR) {
@@ -189,7 +189,7 @@ public class TimeUtils { return daysAgo(date, System.currentTimeMillis());
}
- public static int daysAgo(Date date, long now) {
+ static int daysAgo(Date date, long now) {
long today = ONEDAY * (now/ONEDAY);
long day = ONEDAY * (date.getTime()/ONEDAY);
long diff = today - day;
@@ -239,7 +239,7 @@ public class TimeUtils { }
- public String timeAgo(Date date, boolean css, long now) {
+ String timeAgo(Date date, boolean css, long now) {
Date dNow = new Date(now);
if (isToday(date, timezone, dNow) || isYesterday(date, timezone, dNow)) {
int mins = minutesAgo(date, now, true);
diff --git a/src/test/java/com/gitblit/tests/GitBlitSuite.java b/src/test/java/com/gitblit/tests/GitBlitSuite.java index 3292d090..fbae039c 100644 --- a/src/test/java/com/gitblit/tests/GitBlitSuite.java +++ b/src/test/java/com/gitblit/tests/GitBlitSuite.java @@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
+import com.gitblit.utils.TimeUtilsTest;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryCache;
diff --git a/src/test/java/com/gitblit/tests/TimeUtilsTest.java b/src/test/java/com/gitblit/utils/TimeUtilsTest.java index 2dde6d51..77710e06 100644 --- a/src/test/java/com/gitblit/tests/TimeUtilsTest.java +++ b/src/test/java/com/gitblit/utils/TimeUtilsTest.java @@ -13,17 +13,18 @@ * See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gitblit.tests;
+package com.gitblit.utils;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
+import com.gitblit.tests.GitblitUnitTest;
import org.junit.Test;
-import com.gitblit.utils.TimeUtils;
-public class TimeUtilsTest extends GitblitUnitTest {
+public class TimeUtilsTest extends GitblitUnitTest
+{
private Date offset(long subtract) {
return new Date(System.currentTimeMillis() - subtract);
|