From 0af76547641987bc736d659b4eaf7cd720028288 Mon Sep 17 00:00:00 2001 From: Joshua Jackson Date: Mon, 11 Dec 2017 05:45:27 -0600 Subject: [PATCH] Fix iOS build --- src/tz.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tz.cpp b/src/tz.cpp index 60a8e81..d06e547 100644 --- a/src/tz.cpp +++ b/src/tz.cpp @@ -86,6 +86,10 @@ #include "date/tz_private.h" #include "date/ios.h" +#ifndef __APPLE__ +# define TARGET_OS_IPHONE 0 +#endif + #if USE_OS_TZDB # include #endif @@ -333,6 +337,9 @@ discover_tz_dir() else throw runtime_error("discover_tz_dir failed to find zoneinfo\n"); # else // __APPLE__ +# if TARGET_OS_IPHONE + return "/var/db/timezone/zoneinfo"; +# else CONSTDATA auto timezone = "/etc/localtime"; if (!(lstat(timezone, &sb) == 0 && S_ISLNK(sb.st_mode) && sb.st_size > 0)) throw runtime_error("discover_tz_dir failed\n"); @@ -349,6 +356,7 @@ discover_tz_dir() if (i == string::npos) throw runtime_error("discover_tz_dir failed to find '/'\n"); return result.substr(0, i); +# endif # endif // __APPLE__ }