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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « public/common/unicode/pmac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ****************************************************************************** 2 ******************************************************************************
3 * 3 *
4 * Copyright (C) 1997-2010, International Business Machines 4 * Copyright (C) 1997-2010, International Business Machines
5 * Corporation and others. All Rights Reserved. 5 * Corporation and others. All Rights Reserved.
6 * 6 *
7 ****************************************************************************** 7 ******************************************************************************
8 * 8 *
9 * FILE NAME : putil.c (previously putil.cpp and ptypes.cpp) 9 * FILE NAME : putil.c (previously putil.cpp and ptypes.cpp)
10 * 10 *
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 } 616 }
617 617
618 U_CAPI int32_t U_EXPORT2 618 U_CAPI int32_t U_EXPORT2
619 uprv_timezone() 619 uprv_timezone()
620 { 620 {
621 #ifdef U_TIMEZONE 621 #ifdef U_TIMEZONE
622 return U_TIMEZONE; 622 return U_TIMEZONE;
623 #else 623 #else
624 time_t t, t1, t2; 624 time_t t, t1, t2;
625 struct tm tmrec; 625 struct tm tmrec;
626 #ifndef U_IOS
626 UBool dst_checked; 627 UBool dst_checked;
628 #endif
627 int32_t tdiff = 0; 629 int32_t tdiff = 0;
628 630
629 time(&t); 631 time(&t);
630 uprv_memcpy( &tmrec, localtime(&t), sizeof(tmrec) ); 632 uprv_memcpy( &tmrec, localtime(&t), sizeof(tmrec) );
633 #ifndef U_IOS
631 dst_checked = (tmrec.tm_isdst != 0); /* daylight savings time is checked*/ 634 dst_checked = (tmrec.tm_isdst != 0); /* daylight savings time is checked*/
635 #endif
632 t1 = mktime(&tmrec); /* local time in seconds*/ 636 t1 = mktime(&tmrec); /* local time in seconds*/
633 uprv_memcpy( &tmrec, gmtime(&t), sizeof(tmrec) ); 637 uprv_memcpy( &tmrec, gmtime(&t), sizeof(tmrec) );
634 t2 = mktime(&tmrec); /* GMT (or UTC) in seconds*/ 638 t2 = mktime(&tmrec); /* GMT (or UTC) in seconds*/
635 tdiff = t2 - t1; 639 tdiff = t2 - t1;
640 #ifndef U_IOS
641 /* On iOS the calculated tdiff is correct so and doesn't need this dst
642 shift applied. */
636 /* imitate NT behaviour, which returns same timezone offset to GMT for 643 /* imitate NT behaviour, which returns same timezone offset to GMT for
637 winter and summer*/ 644 winter and summer*/
638 if (dst_checked) 645 if (dst_checked)
639 tdiff += 3600; 646 tdiff += 3600;
647 #endif
640 return tdiff; 648 return tdiff;
641 #endif 649 #endif
642 } 650 }
643 651
644 /* Note that U_TZNAME does *not* have to be tzname, but if it is, 652 /* Note that U_TZNAME does *not* have to be tzname, but if it is,
645 some platforms need to have it declared here. */ 653 some platforms need to have it declared here. */
646 654
647 #if defined(U_TZNAME) && (defined(U_IRIX) || defined(U_DARWIN) || defined(U_CYGW IN)) 655 #if defined(U_TZNAME) && (defined(U_IRIX) || defined(U_DARWIN) || defined(U_CYGW IN))
648 /* RS6000 and others reject char **tzname. */ 656 /* RS6000 and others reject char **tzname. */
649 extern U_IMPORT char *U_TZNAME[]; 657 extern U_IMPORT char *U_TZNAME[];
650 #endif 658 #endif
651 659
652 #if !UCONFIG_NO_FILE_IO && (defined(U_DARWIN) || defined(U_LINUX) || defined(U_B SD)) 660 #if !UCONFIG_NO_FILE_IO && ((defined(U_DARWIN) && !defined(U_IOS)) || defined(U_ LINUX) || defined(U_BSD))
653 /* These platforms are likely to use Olson timezone IDs. */ 661 /* These platforms are likely to use Olson timezone IDs. */
654 #define CHECK_LOCALTIME_LINK 1 662 #define CHECK_LOCALTIME_LINK 1
655 #if defined(U_DARWIN) 663 #if defined(U_DARWIN)
656 #include <tzfile.h> 664 #include <tzfile.h>
657 #define TZZONEINFO (TZDIR "/") 665 #define TZZONEINFO (TZDIR "/")
658 #else 666 #else
659 #define TZDEFAULT "/etc/localtime" 667 #define TZDEFAULT "/etc/localtime"
660 #define TZZONEINFO "/usr/share/zoneinfo/" 668 #define TZZONEINFO "/usr/share/zoneinfo/"
661 #endif 669 #endif
662 #if U_HAVE_DIRENT_H 670 #if U_HAVE_DIRENT_H
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 #endif /* U_ENABLE_DYLOAD */ 2241 #endif /* U_ENABLE_DYLOAD */
2234 2242
2235 /* 2243 /*
2236 * Hey, Emacs, please set the following: 2244 * Hey, Emacs, please set the following:
2237 * 2245 *
2238 * Local Variables: 2246 * Local Variables:
2239 * indent-tabs-mode: nil 2247 * indent-tabs-mode: nil
2240 * End: 2248 * End:
2241 * 2249 *
2242 */ 2250 */
OLDNEW
« 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