Skip to content

[CoreFoundation] Revert some Android regressions that crept in #3088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions CoreFoundation/NumberDate.subproj/CFTimeZone.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,15 +899,6 @@ static CFTimeZoneRef __CFTimeZoneCreateSystem(void) {
CFRelease(name);
if (result) return result;
}
#if TARGET_OS_ANDROID
// Timezone database by name not available on Android.
// Approximate with gmtoff - could be general default.
struct tm info;
time_t now = time(NULL);
if (NULL != localtime_r(&now, &info)) {
return CFTimeZoneCreateWithTimeIntervalFromGMT(kCFAllocatorSystemDefault, info.tm_gmtoff);
}
#endif
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was removed a couple years ago by @drodriguez, but the recent Catalina merge inadvertently brought it back.

return CFTimeZoneCreateWithTimeIntervalFromGMT(kCFAllocatorSystemDefault, 0.0);
}

Expand Down Expand Up @@ -1388,7 +1379,7 @@ Boolean _CFTimeZoneInit(CFTimeZoneRef timeZone, CFStringRef name, CFDataRef data
return false;
}
}
if (NULL == data && NULL != baseURL) {
if (NULL == data) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MaxDesiatov, unsure what you're trying to do here, was this failing for you without this check on WASI? Android doesn't use baseURL inside _CFTimeZoneDataCreate(), so this broke initializing time zones in several tests.

Were you just trying to play it safe here or do you need this for WASI?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to say, I'm fine with reverting this bit for now. If this breaks anything for us, I'll know who to ping 🙂

tzName = name;
data = _CFTimeZoneDataCreate(baseURL, tzName);
}
Expand Down