UBool Calendar::operator==(const Calendar& that) const { UErrorCode status = U_ZERO_ERROR; return isEquivalentTo(that) && getTimeInMillis(status) == that.getTimeInMillis(status) && U_SUCCESS(status); }
TEST(CookieDecoderTest, testDecodingLongDates) { Calendar cookieDate = Calendar.getInstance(TimeZone.getTimeZone("UTC")); cookieDate.set(9999, Calendar.DECEMBER, 31, 23, 59, 59); long expectedMaxAge = (cookieDate.getTimeInMillis() - System.currentTimeMillis()) / 1000; String source = "Format=EU; expires=Fri, 31-Dec-9999 23:59:59 GMT; path=/"; Set<Cookie> cookies = CookieDecoder.decode(source); Cookie c = cookies.iterator().next(); assertTrue(Math.abs(expectedMaxAge - c.getMaxAge()) < 2); }
UBool Calendar::after(const Calendar& when, UErrorCode& status) const { return (this != &when && getTimeInMillis(status) > when.getTimeInMillis(status)); }