Start hiding "private/bionic_time.h".
Bug: 15765976 Change-Id: Ibd9cf07067ec8dffe9fda6c3d498d4ab90708220
This commit is contained in:
@@ -27,34 +27,6 @@
|
||||
|
||||
#include "ScopedSignalHandler.h"
|
||||
|
||||
#if defined(__BIONIC__) // mktime_tz is a bionic extension.
|
||||
#include <libc/private/bionic_time.h>
|
||||
#endif // __BIONIC__
|
||||
|
||||
TEST(time, mktime_tz) {
|
||||
#if defined(__BIONIC__)
|
||||
struct tm epoch;
|
||||
memset(&epoch, 0, sizeof(tm));
|
||||
epoch.tm_year = 1970 - 1900;
|
||||
epoch.tm_mon = 1;
|
||||
epoch.tm_mday = 1;
|
||||
|
||||
// Alphabetically first. Coincidentally equivalent to UTC.
|
||||
ASSERT_EQ(2678400, mktime_tz(&epoch, "Africa/Abidjan"));
|
||||
|
||||
// Alphabetically last. Coincidentally equivalent to UTC.
|
||||
ASSERT_EQ(2678400, mktime_tz(&epoch, "Zulu"));
|
||||
|
||||
// Somewhere in the middle, not UTC.
|
||||
ASSERT_EQ(2707200, mktime_tz(&epoch, "America/Los_Angeles"));
|
||||
|
||||
// Missing. Falls back to UTC.
|
||||
ASSERT_EQ(2678400, mktime_tz(&epoch, "PST"));
|
||||
#else // __BIONIC__
|
||||
GTEST_LOG_(INFO) << "This test does nothing.\n";
|
||||
#endif // __BIONIC__
|
||||
}
|
||||
|
||||
TEST(time, gmtime) {
|
||||
time_t t = 0;
|
||||
tm* broken_down = gmtime(&t);
|
||||
@@ -108,9 +80,6 @@ TEST(time, mktime_10310929) {
|
||||
#if !defined(__LP64__)
|
||||
// 32-bit bionic stupidly had a signed 32-bit time_t.
|
||||
ASSERT_EQ(-1, mktime(&t));
|
||||
#if defined(__BIONIC__)
|
||||
ASSERT_EQ(-1, mktime_tz(&t, "UTC"));
|
||||
#endif
|
||||
#else
|
||||
// Everyone else should be using a signed 64-bit time_t.
|
||||
ASSERT_GE(sizeof(time_t) * 8, 64U);
|
||||
@@ -118,16 +87,10 @@ TEST(time, mktime_10310929) {
|
||||
setenv("TZ", "America/Los_Angeles", 1);
|
||||
tzset();
|
||||
ASSERT_EQ(static_cast<time_t>(4108348800U), mktime(&t));
|
||||
#if defined(__BIONIC__)
|
||||
ASSERT_EQ(static_cast<time_t>(4108320000U), mktime_tz(&t, "UTC"));
|
||||
#endif
|
||||
|
||||
setenv("TZ", "UTC", 1);
|
||||
tzset();
|
||||
ASSERT_EQ(static_cast<time_t>(4108320000U), mktime(&t));
|
||||
#if defined(__BIONIC__)
|
||||
ASSERT_EQ(static_cast<time_t>(4108348800U), mktime_tz(&t, "America/Los_Angeles"));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user