From 7c643b65f3613e30a14e8e9decc92fddb8bfd654 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 01 Jul 2011 17:42:56 -0400
Subject: [PATCH] Documentation. Include LICENSE and NOTICE files in both builds.
---
src/com/gitblit/utils/TimeUtils.java | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/com/gitblit/utils/TimeUtils.java b/src/com/gitblit/utils/TimeUtils.java
index ece87dd..dcb60ab 100644
--- a/src/com/gitblit/utils/TimeUtils.java
+++ b/src/com/gitblit/utils/TimeUtils.java
@@ -15,6 +15,7 @@
*/
package com.gitblit.utils;
+import java.util.Calendar;
import java.util.Date;
public class TimeUtils {
@@ -28,18 +29,15 @@
public static final long ONEYEAR = ONEDAY * 365L;
- @SuppressWarnings("deprecation")
public static boolean isToday(Date date) {
- Date now = new Date();
- return now.getDate() == date.getDate() && now.getMonth() == date.getMonth()
- && now.getYear() == date.getYear();
+ return (System.currentTimeMillis() - date.getTime()) < ONEDAY;
}
- @SuppressWarnings("deprecation")
public static boolean isYesterday(Date date) {
- Date now = new Date();
- return now.getDate() == (date.getDate() + 1) && now.getMonth() == date.getMonth()
- && now.getYear() == date.getYear();
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ cal.add(Calendar.DATE, 1);
+ return (System.currentTimeMillis() - cal.getTimeInMillis()) < ONEDAY;
}
public static String duration(int days) {
--
Gitblit v1.9.1