1 19 package org.netbeans.lib.cvsclient.admin; 20 21 27 public class DateComparator { 28 29 private static final long SECONDS_PER_HOUR = 3600; 30 31 private static final DateComparator singleton = new DateComparator(); 32 33 36 public static DateComparator getInstance() { 37 return singleton; 38 } 39 40 44 private DateComparator() { 45 } 46 47 51 public boolean equals(final long fileTime, final long entryTime) { 52 final long fileTimeSeconds = fileTime / 1000; 53 final long entryTimeSeconds = entryTime / 1000; 54 final long difference = Math.abs(fileTimeSeconds - entryTimeSeconds); 55 if (difference < 1) { 57 return true; 58 } 59 60 if (difference >= SECONDS_PER_HOUR - 1 62 && difference <= SECONDS_PER_HOUR + 1) { 63 return true; 64 } 65 return false; 66 } 67 } 68 | Popular Tags |