Update tzcode from 2022a to 2023a.
https://github.com/eggert/tz/commit/57b8fc957a608de6f598a9aca5b5e37c845151c3
changes the way overflows are tracked: now compiler builtins
are used instead of manual arithmetics. But as int_fast32_t on
64-bit Android takes 8 bytes, new logic behaves differently.
See time_test.cpp changes for more details.
Changes were applied using following commands:
1) Checkout tzcode repo
2) Prepare patches for all tzcode file using
git diff 2022a 2023a -- <file-name> > <file-name-patch>
3) Apply these patches to files in bionic using
patch -p1 <file-name> <file-name-patch>
Bug: 279742606
Test: CtsBionicTestCases
Test: CtsLibcoreTestCases
Test: CtsLibcoreOjTestCases
Test: atest toybox-tests
Change-Id: I7772a90538b8185bdd2f4be6e9d1740c95509d6c
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 0fb9bc0..483315d 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -181,10 +181,25 @@
ASSERT_NE(static_cast<time_t>(-1), mktime(&t));
ASSERT_EQ(0, errno);
- // This will overflow for LP32 or LP64.
+ // This will overflow for LP32.
t.tm_year = INT_MAX;
errno = 0;
+#if !defined(__LP64__)
+ ASSERT_EQ(static_cast<time_t>(-1), mktime(&t));
+ ASSERT_EQ(EOVERFLOW, errno);
+#else
+ ASSERT_EQ(static_cast<time_t>(67768036166016000U), mktime(&t));
+ ASSERT_EQ(0, errno);
+#endif
+
+ // This will overflow for LP32 or LP64.
+ // tm_year is int, this t struct points to INT_MAX + 1 no matter what TZ is.
+ t.tm_year = INT_MAX;
+ t.tm_mon = 11;
+ t.tm_mday = 45;
+
+ errno = 0;
ASSERT_EQ(static_cast<time_t>(-1), mktime(&t));
ASSERT_EQ(EOVERFLOW, errno);
}