implement current_zone() for iOS using native API from iOSUtils

This commit is contained in:
Xuesong Hu
2018-01-12 14:59:01 -05:00
committed by Howard Hinnant
parent 09b78ba92c
commit 6941691de4
2 changed files with 13 additions and 0 deletions
+12
View File
@@ -3738,6 +3738,18 @@ tzdb::current_zone() const
// Fall through to try other means.
}
{
// On some versions of some bsd distro's (e.g. iOS),
// it is not possible to use file based approach,
// we switch to system API, calling functions in
// CoreFoundation framework.
#if TARGET_OS_IPHONE
std::string result = date::iOSUtils::get_current_timezone();
if (!result.empty())
return locate_zone(result);
#endif
// Fall through to try other means.
}
{
// On some versions of some linux distro's (e.g. Red Hat),
// the current timezone might be in the first line of
// the /etc/sysconfig/clock file as: