OLD | NEW |
| (Empty) |
1 --- public/common/unicode/pmac.h | |
2 +++ public/common/unicode/pmac.h | |
3 @@ -50,6 +50,16 @@ | |
4 #endif | |
5 | |
6 #include <AvailabilityMacros.h> | |
7 +#include <TargetConditionals.h> | |
8 + | |
9 +/** | |
10 + * Add a second platform define to handle differences between Mac OS X and iOS | |
11 + */ | |
12 +#if TARGET_OS_IPHONE | |
13 +#ifndef U_IOS | |
14 +#define U_IOS | |
15 +#endif | |
16 +#endif | |
17 | |
18 /** | |
19 * \def U_HAVE_DIRENT_H | |
20 @@ -288,11 +299,16 @@ | |
21 #if 1 | |
22 #define U_TZSET tzset | |
23 #endif | |
24 +#ifndef U_IOS | |
25 +/* The iOS version of timezone is busted (at least in the simulator, it is | |
26 + never set to anything useful). Leave it undefined to avoid a code path | |
27 + in putil.c. */ | |
28 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 | |
29 #define U_TIMEZONE 0 | |
30 #else | |
31 #define U_TIMEZONE timezone | |
32 #endif | |
33 +#endif // !U_IOS | |
34 #if 1 | |
35 #define U_TZNAME tzname | |
36 #endif | |
37 --- source/common/putil.c | |
38 +++ source/common/putil.c | |
39 @@ -623,20 +623,28 @@ uprv_timezone() | |
40 #else | |
41 time_t t, t1, t2; | |
42 struct tm tmrec; | |
43 +#ifndef U_IOS | |
44 UBool dst_checked; | |
45 +#endif | |
46 int32_t tdiff = 0; | |
47 | |
48 time(&t); | |
49 uprv_memcpy( &tmrec, localtime(&t), sizeof(tmrec) ); | |
50 +#ifndef U_IOS | |
51 dst_checked = (tmrec.tm_isdst != 0); /* daylight savings time is checked*/ | |
52 +#endif | |
53 t1 = mktime(&tmrec); /* local time in seconds*/ | |
54 uprv_memcpy( &tmrec, gmtime(&t), sizeof(tmrec) ); | |
55 t2 = mktime(&tmrec); /* GMT (or UTC) in seconds*/ | |
56 tdiff = t2 - t1; | |
57 +#ifndef U_IOS | |
58 + /* On iOS the calculated tdiff is correct so and doesn't need this dst | |
59 + shift applied. */ | |
60 /* imitate NT behaviour, which returns same timezone offset to GMT for | |
61 winter and summer*/ | |
62 if (dst_checked) | |
63 tdiff += 3600; | |
64 +#endif | |
65 return tdiff; | |
66 #endif | |
67 } | |
68 @@ -649,7 +661,7 @@ uprv_timezone() | |
69 extern U_IMPORT char *U_TZNAME[]; | |
70 #endif | |
71 | |
72 -#if !UCONFIG_NO_FILE_IO && (defined(U_DARWIN) || defined(U_LINUX) || defined(U_
BSD)) | |
73 +#if !UCONFIG_NO_FILE_IO && ((defined(U_DARWIN) && !defined(U_IOS)) || defined(U
_LINUX) || defined(U_BSD)) | |
74 /* These platforms are likely to use Olson timezone IDs. */ | |
75 #define CHECK_LOCALTIME_LINK 1 | |
76 #if defined(U_DARWIN) | |
OLD | NEW |