I want to compare a “now” long/date value minus a “last notification time” long/data value to an integer value representing an interval of minutes before a new notification is made.
I know I cannot simply do this:
bool bItIsTime = (iMinutesBetweenNotifications < (lLastNotificationTime - lRightNow));
…but what is the way to do it. If the value of “now” is 42.2468, would 41.2468 be yesterday at this time? IOW, does 1.00 == 1 day? (in which case 0.1 == 144 minutes, 0.01 == 14.4 minutes, etc.)?
If you are extracting the
longvalue of the last notification time from a Date or Calendar object, the value is usually the number of milliseconds since January 1, 1970 GMT. This is also the same units that you get fromSystem.currentTimeMillis(). You can do your test like this: