45
46 instances = {}
47
49 cls.default = ICUtzinfo(TimeZone.createDefault())
50 _resetDefault = classmethod(_resetDefault)
51
53 try:
54 return cls.instances[id]
55 except KeyError:
56 if id == FLOATING_TZNAME:
57 instance = cls.floating
58 else:
59 instance = cls(TimeZone.createTimeZone(id))
60 cls.instances[id] = instance
61 return instance
62 getInstance = classmethod(getInstance)
63
65 return cls.default
66 getDefault = classmethod(getDefault)
67
69 return cls.floating
70 getFloating = classmethod(getFloating)
71
73 if not isinstance(timezone, TimeZone):
74 raise TypeError, timezone
75 super(ICUtzinfo, self).__init__()
76 self._timezone = timezone
77
79 return "<ICUtzinfo: %s>" %(self._timezone.getID())
80
82 return str(self._timezone.getID())
83
85 if isinstance(other, ICUtzinfo):
86 return str(self) == str(other)
87 return False
88
90 if isinstance(other, ICUtzinfo):
91 return str(self) != str(other)
92 return True
93
95 return hash(self.tzid)
96
98 return ((dt.toordinal() - 719163) * 86400.0 +
99 dt.hour * 3600.0 + dt.minute * 60.0 +
100 float(dt.second) + dt.microsecond / 1e6)
101
103 raw, dst = self._timezone.getOffset(self._notzsecs(dt), True)
104 return timedelta(seconds = (raw + dst) / 1000)
105
107 raw, dst = self._timezone.getOffset(self._notzsecs(dt), True)
108 return timedelta(seconds = dst / 1000)
109
111 return str(self._timezone.getID())
112
114 return TimeZone.createTimeZone(self._timezone.getID())
115
116 tzid = property(__str__)
117 timezone = property(_getTimezone)
121
123 pass
124
126 return "<FloatingTZ: %s>" %(ICUtzinfo.default._timezone.getID())
127
129 return FLOATING_TZNAME
130
132 return hash(FLOATING_TZNAME)
133
135 tz = ICUtzinfo.default._timezone
136 raw, dst = tz.getOffset(self._notzsecs(dt), True)
137 return timedelta(seconds = (raw + dst) / 1000)
138
140 tz = ICUtzinfo.default._timezone
141 raw, dst = tz.getOffset(self._notzsecs(dt), True)
142 return timedelta(seconds = dst / 1000)
143
145 return TimeZone.createTimeZone(ICUtzinfo.default._timezone.getID())
146
148 return ICUtzinfo.default._timezone
149
151 return FLOATING_TZNAME
152
153 tzid = FLOATING_TZNAME
154 _timezone = property(__getTimezone)