OLD | NEW |
1 /* | 1 /* |
2 ****************************************************************************** | 2 ****************************************************************************** |
3 * Copyright (C) 2007-2013, International Business Machines Corporation | 3 * Copyright (C) 2007-2014, International Business Machines Corporation |
4 * and others. All Rights Reserved. | 4 * and others. All Rights Reserved. |
5 ****************************************************************************** | 5 ****************************************************************************** |
6 * | 6 * |
7 * File CHNSECAL.CPP | 7 * File CHNSECAL.CPP |
8 * | 8 * |
9 * Modification History: | 9 * Modification History: |
10 * | 10 * |
11 * Date Name Description | 11 * Date Name Description |
12 * 9/18/2007 ajmacher ported from java ChineseCalendar | 12 * 9/18/2007 ajmacher ported from java ChineseCalendar |
13 ***************************************************************************** | 13 ***************************************************************************** |
(...skipping 28 matching lines...) Expand all Loading... |
42 fflush(stderr); | 42 fflush(stderr); |
43 } | 43 } |
44 // must use double parens, i.e.: U_DEBUG_CHNSECAL_MSG(("four is: %d",4)); | 44 // must use double parens, i.e.: U_DEBUG_CHNSECAL_MSG(("four is: %d",4)); |
45 #define U_DEBUG_CHNSECAL_MSG(x) {debug_chnsecal_loc(__FILE__,__LINE__);debug_chn
secal_msg x;} | 45 #define U_DEBUG_CHNSECAL_MSG(x) {debug_chnsecal_loc(__FILE__,__LINE__);debug_chn
secal_msg x;} |
46 #else | 46 #else |
47 #define U_DEBUG_CHNSECAL_MSG(x) | 47 #define U_DEBUG_CHNSECAL_MSG(x) |
48 #endif | 48 #endif |
49 | 49 |
50 | 50 |
51 // --- The cache -- | 51 // --- The cache -- |
52 static UMutex astroLock = U_MUTEX_INITIALIZER; // pod bay door lock | 52 static UMutex astroLock = U_MUTEX_INITIALIZER; // Protects access to gChineseCa
lendarAstro. |
53 static icu::CalendarAstronomer *gChineseCalendarAstro = NULL; | 53 static icu::CalendarAstronomer *gChineseCalendarAstro = NULL; |
| 54 |
| 55 // Lazy Creation & Access synchronized by class CalendarCache with a mutex. |
54 static icu::CalendarCache *gChineseCalendarWinterSolsticeCache = NULL; | 56 static icu::CalendarCache *gChineseCalendarWinterSolsticeCache = NULL; |
55 static icu::CalendarCache *gChineseCalendarNewYearCache = NULL; | 57 static icu::CalendarCache *gChineseCalendarNewYearCache = NULL; |
| 58 |
56 static icu::TimeZone *gChineseCalendarZoneAstroCalc = NULL; | 59 static icu::TimeZone *gChineseCalendarZoneAstroCalc = NULL; |
57 static icu::UInitOnce gChineseCalendarZoneAstroCalcInitOnce = U_INITONCE_INITIAL
IZER; | 60 static icu::UInitOnce gChineseCalendarZoneAstroCalcInitOnce = U_INITONCE_INITIAL
IZER; |
58 | 61 |
59 /** | 62 /** |
60 * The start year of the Chinese calendar, the 61st year of the reign | 63 * The start year of the Chinese calendar, the 61st year of the reign |
61 * of Huang Di. Some sources use the first year of his reign, | 64 * of Huang Di. Some sources use the first year of his reign, |
62 * resulting in EXTENDED_YEAR values 60 years greater and ERA (cycle) | 65 * resulting in EXTENDED_YEAR values 60 years greater and ERA (cycle) |
63 * values one greater. | 66 * values one greater. |
64 */ | 67 */ |
65 static const int32_t CHINESE_EPOCH_YEAR = -2636; // Gregorian year | 68 static const int32_t CHINESE_EPOCH_YEAR = -2636; // Gregorian year |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 umtx_initOnce(gSystemDefaultCenturyInitOnce, &initializeSystemDefaultCentury
); | 891 umtx_initOnce(gSystemDefaultCenturyInitOnce, &initializeSystemDefaultCentury
); |
889 return gSystemDefaultCenturyStartYear; | 892 return gSystemDefaultCenturyStartYear; |
890 } | 893 } |
891 | 894 |
892 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ChineseCalendar) | 895 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ChineseCalendar) |
893 | 896 |
894 U_NAMESPACE_END | 897 U_NAMESPACE_END |
895 | 898 |
896 #endif | 899 #endif |
897 | 900 |
OLD | NEW |