@@ -1648,13 +1648,32 @@ CFTimeInterval CFTimeZoneGetSecondsFromGMT(CFTimeZoneRef tz, CFAbsoluteTime at)
1648
1648
return __CFTZPeriodGMTOffset (& (tz -> _periods [idx ]));
1649
1649
}
1650
1650
1651
+ extern UCalendar * __CFCalendarCreateUCalendar (CFStringRef calendarID , CFStringRef localeID , CFTimeZoneRef tz );
1652
+
1651
1653
CFStringRef CFTimeZoneCopyAbbreviation (CFTimeZoneRef tz , CFAbsoluteTime at ) {
1652
1654
CFStringRef result ;
1653
1655
CFIndex idx ;
1654
1656
__CFGenericValidateType (tz , CFTimeZoneGetTypeID ());
1657
+ #if TARGET_OS_WIN32
1658
+ UErrorCode status = U_ZERO_ERROR ;
1659
+ UCalendar * ucal = __CFCalendarCreateUCalendar (NULL , CFSTR ("C" ), tz );
1660
+ if (ucal == NULL ) {
1661
+ return NULL ;
1662
+ }
1663
+ ucal_setMillis (ucal , (at + kCFAbsoluteTimeIntervalSince1970 ) * 1000.0 , & status );
1664
+
1665
+ UChar buffer [64 ];
1666
+ int32_t length ;
1667
+ length = ucal_getTimeZoneDisplayName (ucal , UCAL_SHORT_STANDARD , "C" , buffer , sizeof (buffer ), & status );
1668
+
1669
+ ucal_close (ucal );
1670
+
1671
+ return length <= sizeof (buffer ) ? CFStringCreateWithCharacters (kCFAllocatorSystemDefault , buffer , length ) : NULL ;
1672
+ #else
1655
1673
idx = __CFBSearchTZPeriods (tz , at );
1656
1674
result = __CFTZPeriodAbbreviation (& (tz -> _periods [idx ]));
1657
1675
return result ? (CFStringRef )CFRetain (result ) : NULL ;
1676
+ #endif
1658
1677
}
1659
1678
1660
1679
Boolean CFTimeZoneIsDaylightSavingTime (CFTimeZoneRef tz , CFAbsoluteTime at ) {
@@ -1682,15 +1701,29 @@ CFTimeInterval CFTimeZoneGetDaylightSavingTimeOffset(CFTimeZoneRef tz, CFAbsolut
1682
1701
CFAbsoluteTime CFTimeZoneGetNextDaylightSavingTimeTransition (CFTimeZoneRef tz , CFAbsoluteTime at ) {
1683
1702
CF_OBJC_FUNCDISPATCHV (CFTimeZoneGetTypeID (), CFTimeInterval , (NSTimeZone * )tz , _nextDaylightSavingTimeTransitionAfterAbsoluteTime :at );
1684
1703
__CFGenericValidateType (tz , CFTimeZoneGetTypeID ());
1704
+ #if TARGET_OS_WIN32
1705
+ UErrorCode status = U_ZERO_ERROR ;
1706
+ UCalendar * ucal = __CFCalendarCreateUCalendar (NULL , CFSTR ("C" ), tz );
1707
+ if (ucal == NULL ) {
1708
+ return 0.0 ;
1709
+ }
1710
+ ucal_setMillis (ucal , (at + kCFAbsoluteTimeIntervalSince1970 ) * 1000.0 , & status );
1711
+
1712
+ UDate date ;
1713
+ ucal_getTimeZoneTransitionDate (ucal , UCAL_TZ_TRANSITION_NEXT , & date , & status );
1714
+
1715
+ ucal_close (ucal );
1716
+
1717
+ return (date / 1000.0 ) - kCFAbsoluteTimeIntervalSince1970 ;
1718
+ #else
1685
1719
CFIndex idx = __CFBSearchTZPeriods (tz , at );
1686
1720
if (tz -> _periodCnt <= idx + 1 ) {
1687
1721
return 0.0 ;
1688
1722
}
1689
1723
return (CFAbsoluteTime )__CFTZPeriodStartSeconds (& (tz -> _periods [idx + 1 ]));
1724
+ #endif
1690
1725
}
1691
1726
1692
- extern UCalendar * __CFCalendarCreateUCalendar (CFStringRef calendarID , CFStringRef localeID , CFTimeZoneRef tz );
1693
-
1694
1727
#define BUFFER_SIZE 768
1695
1728
1696
1729
CFStringRef CFTimeZoneCopyLocalizedName (CFTimeZoneRef tz , CFTimeZoneNameStyle style , CFLocaleRef locale ) {
0 commit comments