Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1437)

Unified Diff: source/common/putil.c

Issue 10692124: Fix ICU time zone support on iOS (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/icu46
Patch Set: Added another bug ref Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « public/common/unicode/pmac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/common/putil.c
diff --git a/source/common/putil.c b/source/common/putil.c
index a061656884da5314f606cf4367f3f03a7d7737d4..3a1cea4dd785cd9fcc60db6cd440a49350798b90 100644
--- a/source/common/putil.c
+++ b/source/common/putil.c
@@ -623,20 +623,28 @@ uprv_timezone()
#else
time_t t, t1, t2;
struct tm tmrec;
+#ifndef U_IOS
UBool dst_checked;
+#endif
int32_t tdiff = 0;
time(&t);
uprv_memcpy( &tmrec, localtime(&t), sizeof(tmrec) );
+#ifndef U_IOS
dst_checked = (tmrec.tm_isdst != 0); /* daylight savings time is checked*/
+#endif
t1 = mktime(&tmrec); /* local time in seconds*/
uprv_memcpy( &tmrec, gmtime(&t), sizeof(tmrec) );
t2 = mktime(&tmrec); /* GMT (or UTC) in seconds*/
tdiff = t2 - t1;
+#ifndef U_IOS
+ /* On iOS the calculated tdiff is correct so and doesn't need this dst
+ shift applied. */
/* imitate NT behaviour, which returns same timezone offset to GMT for
winter and summer*/
if (dst_checked)
tdiff += 3600;
+#endif
return tdiff;
#endif
}
@@ -649,7 +657,7 @@ uprv_timezone()
extern U_IMPORT char *U_TZNAME[];
#endif
-#if !UCONFIG_NO_FILE_IO && (defined(U_DARWIN) || defined(U_LINUX) || defined(U_BSD))
+#if !UCONFIG_NO_FILE_IO && ((defined(U_DARWIN) && !defined(U_IOS)) || defined(U_LINUX) || defined(U_BSD))
/* These platforms are likely to use Olson timezone IDs. */
#define CHECK_LOCALTIME_LINK 1
#if defined(U_DARWIN)
« no previous file with comments | « public/common/unicode/pmac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698