James Moger
2012-01-05 cb285cbfddfc0b633d6b8cdb4dc0d2bd2b8b51ef
src/com/gitblit/utils/TimeUtils.java
@@ -145,15 +145,13 @@
    * Return the difference in days between now and the date.
    * 
    * @param date
    * @param roundup
    * @return days ago
    */
   public static int daysAgo(Date date, boolean roundup) {
      long diff = System.currentTimeMillis() - date.getTime();
   public static int daysAgo(Date date) {
      long today = ONEDAY * (System.currentTimeMillis()/ONEDAY);
      long day = ONEDAY * (date.getTime()/ONEDAY);
      long diff = today - day;
      int days = (int) (diff / ONEDAY);
      if (roundup && (diff % ONEDAY) > 0) {
         days++;
      }
      return days;
   }
@@ -208,7 +206,7 @@
         if (css) {
            return "age2";
         }
         int days = daysAgo(date, true);
         int days = daysAgo(date);
         if (days < 365) {
            if (days <= 30) {
               return days + " days ago";
@@ -253,11 +251,9 @@
      int mins = 60;
      if (!StringUtils.isEmpty(frequency)) {
         try {
            String str;
            String str = frequency.trim();
            if (frequency.indexOf(' ') > -1) {
               str = frequency.substring(0, frequency.indexOf(' ')).trim();
            } else {
               str = frequency.trim();
               str = str.substring(0, str.indexOf(' ')).trim();
            }
            mins = (int) Float.parseFloat(str);
         } catch (NumberFormatException e) {
@@ -268,7 +264,7 @@
      }
      if (frequency.indexOf("day") > -1) {
         // convert to minutes
         mins *= 24 * 60;
         mins *= 1440;
      } else if (frequency.indexOf("hour") > -1) {
         // convert to minutes
         mins *= 60;