1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00

Merge pull request #113 from andrewachen/merge

Use a constant for 18 hours.
This commit is contained in:
Andrew Chen 2012-01-05 19:04:46 -08:00
commit d4380c0139

View File

@ -186,6 +186,7 @@ public class Utility {
} }
} }
private static final long MILISECONDS_IN_18_HOURS = 18 * 60 * 60 * 1000;
/** /**
* Returns true if the specified date is within 18 hours of "now". Returns false otherwise. * Returns true if the specified date is within 18 hours of "now". Returns false otherwise.
* @param date * @param date
@ -193,7 +194,7 @@ public class Utility {
*/ */
public static boolean isDateToday(Date date) { public static boolean isDateToday(Date date) {
Date now = new Date(); Date now = new Date();
if (now.getTime() - 64800000 > date.getTime() || now.getTime() + 64800000 < date.getTime()) { if (now.getTime() - MILISECONDS_IN_18_HOURS > date.getTime() || now.getTime() + MILISECONDS_IN_18_HOURS < date.getTime()) {
return false; return false;
} else { } else {
return true; return true;