tzinfo 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of tzinfo might be problematic. Click here for more details.
- data/CHANGES +7 -0
- data/Rakefile +1 -1
- data/lib/tzinfo/definitions/America/Havana.rb +1 -3
- data/lib/tzinfo/definitions/America/Managua.rb +2 -2
- data/lib/tzinfo/definitions/Asia/Amman.rb +86 -86
- data/lib/tzinfo/definitions/Asia/Baku.rb +99 -99
- data/lib/tzinfo/definitions/Asia/Gaza.rb +84 -84
- data/lib/tzinfo/definitions/Asia/Tbilisi.rb +1 -82
- data/lib/tzinfo/timezone.rb +2 -1
- data/lib/tzinfo/timezone_period_list.rb +53 -50
- data/lib/tzinfo/tzdataparser.rb +1 -1
- data/test/tc_timezone_period_list.rb +10 -0
- data/test/tc_timezone_utc.rb +29 -0
- metadata +3 -16
- data/lib/tzinfo/definitions/SystemV/AST4.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/AST4ADT.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/CST6.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/CST6CDT.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/EST5.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/EST5EDT.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/HST10.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/MST7.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/MST7MDT.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/PST8.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/PST8PDT.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/YST9.rb +0 -11
- data/lib/tzinfo/definitions/SystemV/YST9YDT.rb +0 -11
@@ -60,88 +60,7 @@ add_period(2003,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58870519,24)
|
|
60
60
|
add_period(2004,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(7359277,3),0,Date::ITALY),DateTime.new0(Rational.new!(58876399,24),0,Date::ITALY),14400,3600,:'GEST')}
|
61
61
|
add_period(2004,6) {TimezonePeriod.new(DateTime.new0(Rational.new!(58876399,24),0,Date::ITALY),DateTime.new0(Rational.new!(58879427,24),0,Date::ITALY),10800,3600,:'GET')}
|
62
62
|
add_period(2004,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58879427,24),0,Date::ITALY),DateTime.new0(Rational.new!(58882955,24),0,Date::ITALY),10800,0,:'GET')}
|
63
|
-
add_period(2005,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58882955,24),0,Date::ITALY),
|
64
|
-
add_period(2005,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58888163,24),0,Date::ITALY),DateTime.new0(Rational.new!(58891691,24),0,Date::ITALY),10800,0,:'GET')}
|
65
|
-
add_period(2006,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58891691,24),0,Date::ITALY),DateTime.new0(Rational.new!(58896899,24),0,Date::ITALY),10800,3600,:'GEST')}
|
66
|
-
add_period(2006,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58896899,24),0,Date::ITALY),DateTime.new0(Rational.new!(58900427,24),0,Date::ITALY),10800,0,:'GET')}
|
67
|
-
add_period(2007,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58900427,24),0,Date::ITALY),DateTime.new0(Rational.new!(58905635,24),0,Date::ITALY),10800,3600,:'GEST')}
|
68
|
-
add_period(2007,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58905635,24),0,Date::ITALY),DateTime.new0(Rational.new!(58909331,24),0,Date::ITALY),10800,0,:'GET')}
|
69
|
-
add_period(2008,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58909331,24),0,Date::ITALY),DateTime.new0(Rational.new!(58914371,24),0,Date::ITALY),10800,3600,:'GEST')}
|
70
|
-
add_period(2008,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58914371,24),0,Date::ITALY),DateTime.new0(Rational.new!(58918067,24),0,Date::ITALY),10800,0,:'GET')}
|
71
|
-
add_period(2009,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58918067,24),0,Date::ITALY),DateTime.new0(Rational.new!(58923107,24),0,Date::ITALY),10800,3600,:'GEST')}
|
72
|
-
add_period(2009,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58923107,24),0,Date::ITALY),DateTime.new0(Rational.new!(58926803,24),0,Date::ITALY),10800,0,:'GET')}
|
73
|
-
add_period(2010,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58926803,24),0,Date::ITALY),DateTime.new0(Rational.new!(58932011,24),0,Date::ITALY),10800,3600,:'GEST')}
|
74
|
-
add_period(2010,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58932011,24),0,Date::ITALY),DateTime.new0(Rational.new!(58935539,24),0,Date::ITALY),10800,0,:'GET')}
|
75
|
-
add_period(2011,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58935539,24),0,Date::ITALY),DateTime.new0(Rational.new!(58940747,24),0,Date::ITALY),10800,3600,:'GEST')}
|
76
|
-
add_period(2011,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58940747,24),0,Date::ITALY),DateTime.new0(Rational.new!(58944275,24),0,Date::ITALY),10800,0,:'GET')}
|
77
|
-
add_period(2012,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58944275,24),0,Date::ITALY),DateTime.new0(Rational.new!(58949483,24),0,Date::ITALY),10800,3600,:'GEST')}
|
78
|
-
add_period(2012,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58949483,24),0,Date::ITALY),DateTime.new0(Rational.new!(58953179,24),0,Date::ITALY),10800,0,:'GET')}
|
79
|
-
add_period(2013,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58953179,24),0,Date::ITALY),DateTime.new0(Rational.new!(58958219,24),0,Date::ITALY),10800,3600,:'GEST')}
|
80
|
-
add_period(2013,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58958219,24),0,Date::ITALY),DateTime.new0(Rational.new!(58961915,24),0,Date::ITALY),10800,0,:'GET')}
|
81
|
-
add_period(2014,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58961915,24),0,Date::ITALY),DateTime.new0(Rational.new!(58966955,24),0,Date::ITALY),10800,3600,:'GEST')}
|
82
|
-
add_period(2014,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58966955,24),0,Date::ITALY),DateTime.new0(Rational.new!(58970651,24),0,Date::ITALY),10800,0,:'GET')}
|
83
|
-
add_period(2015,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58970651,24),0,Date::ITALY),DateTime.new0(Rational.new!(58975691,24),0,Date::ITALY),10800,3600,:'GEST')}
|
84
|
-
add_period(2015,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58975691,24),0,Date::ITALY),DateTime.new0(Rational.new!(58979387,24),0,Date::ITALY),10800,0,:'GET')}
|
85
|
-
add_period(2016,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58979387,24),0,Date::ITALY),DateTime.new0(Rational.new!(58984595,24),0,Date::ITALY),10800,3600,:'GEST')}
|
86
|
-
add_period(2016,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58984595,24),0,Date::ITALY),DateTime.new0(Rational.new!(58988123,24),0,Date::ITALY),10800,0,:'GET')}
|
87
|
-
add_period(2017,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58988123,24),0,Date::ITALY),DateTime.new0(Rational.new!(58993331,24),0,Date::ITALY),10800,3600,:'GEST')}
|
88
|
-
add_period(2017,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(58993331,24),0,Date::ITALY),DateTime.new0(Rational.new!(58996859,24),0,Date::ITALY),10800,0,:'GET')}
|
89
|
-
add_period(2018,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58996859,24),0,Date::ITALY),DateTime.new0(Rational.new!(59002067,24),0,Date::ITALY),10800,3600,:'GEST')}
|
90
|
-
add_period(2018,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59002067,24),0,Date::ITALY),DateTime.new0(Rational.new!(59005763,24),0,Date::ITALY),10800,0,:'GET')}
|
91
|
-
add_period(2019,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59005763,24),0,Date::ITALY),DateTime.new0(Rational.new!(59010803,24),0,Date::ITALY),10800,3600,:'GEST')}
|
92
|
-
add_period(2019,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59010803,24),0,Date::ITALY),DateTime.new0(Rational.new!(59014499,24),0,Date::ITALY),10800,0,:'GET')}
|
93
|
-
add_period(2020,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59014499,24),0,Date::ITALY),DateTime.new0(Rational.new!(59019539,24),0,Date::ITALY),10800,3600,:'GEST')}
|
94
|
-
add_period(2020,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59019539,24),0,Date::ITALY),DateTime.new0(Rational.new!(59023235,24),0,Date::ITALY),10800,0,:'GET')}
|
95
|
-
add_period(2021,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59023235,24),0,Date::ITALY),DateTime.new0(Rational.new!(59028443,24),0,Date::ITALY),10800,3600,:'GEST')}
|
96
|
-
add_period(2021,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59028443,24),0,Date::ITALY),DateTime.new0(Rational.new!(59031971,24),0,Date::ITALY),10800,0,:'GET')}
|
97
|
-
add_period(2022,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59031971,24),0,Date::ITALY),DateTime.new0(Rational.new!(59037179,24),0,Date::ITALY),10800,3600,:'GEST')}
|
98
|
-
add_period(2022,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59037179,24),0,Date::ITALY),DateTime.new0(Rational.new!(59040707,24),0,Date::ITALY),10800,0,:'GET')}
|
99
|
-
add_period(2023,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59040707,24),0,Date::ITALY),DateTime.new0(Rational.new!(59045915,24),0,Date::ITALY),10800,3600,:'GEST')}
|
100
|
-
add_period(2023,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59045915,24),0,Date::ITALY),DateTime.new0(Rational.new!(59049611,24),0,Date::ITALY),10800,0,:'GET')}
|
101
|
-
add_period(2024,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59049611,24),0,Date::ITALY),DateTime.new0(Rational.new!(59054651,24),0,Date::ITALY),10800,3600,:'GEST')}
|
102
|
-
add_period(2024,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59054651,24),0,Date::ITALY),DateTime.new0(Rational.new!(59058347,24),0,Date::ITALY),10800,0,:'GET')}
|
103
|
-
add_period(2025,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59058347,24),0,Date::ITALY),DateTime.new0(Rational.new!(59063387,24),0,Date::ITALY),10800,3600,:'GEST')}
|
104
|
-
add_period(2025,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59063387,24),0,Date::ITALY),DateTime.new0(Rational.new!(59067083,24),0,Date::ITALY),10800,0,:'GET')}
|
105
|
-
add_period(2026,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59067083,24),0,Date::ITALY),DateTime.new0(Rational.new!(59072123,24),0,Date::ITALY),10800,3600,:'GEST')}
|
106
|
-
add_period(2026,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59072123,24),0,Date::ITALY),DateTime.new0(Rational.new!(59075819,24),0,Date::ITALY),10800,0,:'GET')}
|
107
|
-
add_period(2027,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59075819,24),0,Date::ITALY),DateTime.new0(Rational.new!(59081027,24),0,Date::ITALY),10800,3600,:'GEST')}
|
108
|
-
add_period(2027,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59081027,24),0,Date::ITALY),DateTime.new0(Rational.new!(59084555,24),0,Date::ITALY),10800,0,:'GET')}
|
109
|
-
add_period(2028,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59084555,24),0,Date::ITALY),DateTime.new0(Rational.new!(59089763,24),0,Date::ITALY),10800,3600,:'GEST')}
|
110
|
-
add_period(2028,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59089763,24),0,Date::ITALY),DateTime.new0(Rational.new!(59093291,24),0,Date::ITALY),10800,0,:'GET')}
|
111
|
-
add_period(2029,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59093291,24),0,Date::ITALY),DateTime.new0(Rational.new!(59098499,24),0,Date::ITALY),10800,3600,:'GEST')}
|
112
|
-
add_period(2029,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59098499,24),0,Date::ITALY),DateTime.new0(Rational.new!(59102195,24),0,Date::ITALY),10800,0,:'GET')}
|
113
|
-
add_period(2030,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59102195,24),0,Date::ITALY),DateTime.new0(Rational.new!(59107235,24),0,Date::ITALY),10800,3600,:'GEST')}
|
114
|
-
add_period(2030,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59107235,24),0,Date::ITALY),DateTime.new0(Rational.new!(59110931,24),0,Date::ITALY),10800,0,:'GET')}
|
115
|
-
add_period(2031,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59110931,24),0,Date::ITALY),DateTime.new0(Rational.new!(59115971,24),0,Date::ITALY),10800,3600,:'GEST')}
|
116
|
-
add_period(2031,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59115971,24),0,Date::ITALY),DateTime.new0(Rational.new!(59119667,24),0,Date::ITALY),10800,0,:'GET')}
|
117
|
-
add_period(2032,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59119667,24),0,Date::ITALY),DateTime.new0(Rational.new!(59124875,24),0,Date::ITALY),10800,3600,:'GEST')}
|
118
|
-
add_period(2032,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59124875,24),0,Date::ITALY),DateTime.new0(Rational.new!(59128403,24),0,Date::ITALY),10800,0,:'GET')}
|
119
|
-
add_period(2033,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59128403,24),0,Date::ITALY),DateTime.new0(Rational.new!(59133611,24),0,Date::ITALY),10800,3600,:'GEST')}
|
120
|
-
add_period(2033,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59133611,24),0,Date::ITALY),DateTime.new0(Rational.new!(59137139,24),0,Date::ITALY),10800,0,:'GET')}
|
121
|
-
add_period(2034,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59137139,24),0,Date::ITALY),DateTime.new0(Rational.new!(59142347,24),0,Date::ITALY),10800,3600,:'GEST')}
|
122
|
-
add_period(2034,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59142347,24),0,Date::ITALY),DateTime.new0(Rational.new!(59145875,24),0,Date::ITALY),10800,0,:'GET')}
|
123
|
-
add_period(2035,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59145875,24),0,Date::ITALY),DateTime.new0(Rational.new!(59151083,24),0,Date::ITALY),10800,3600,:'GEST')}
|
124
|
-
add_period(2035,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59151083,24),0,Date::ITALY),DateTime.new0(Rational.new!(59154779,24),0,Date::ITALY),10800,0,:'GET')}
|
125
|
-
add_period(2036,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59154779,24),0,Date::ITALY),DateTime.new0(Rational.new!(59159819,24),0,Date::ITALY),10800,3600,:'GEST')}
|
126
|
-
add_period(2036,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59159819,24),0,Date::ITALY),DateTime.new0(Rational.new!(59163515,24),0,Date::ITALY),10800,0,:'GET')}
|
127
|
-
add_period(2037,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59163515,24),0,Date::ITALY),DateTime.new0(Rational.new!(59168555,24),0,Date::ITALY),10800,3600,:'GEST')}
|
128
|
-
add_period(2037,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59168555,24),0,Date::ITALY),DateTime.new0(Rational.new!(59172251,24),0,Date::ITALY),10800,0,:'GET')}
|
129
|
-
add_period(2038,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59172251,24),0,Date::ITALY),DateTime.new0(Rational.new!(59177459,24),0,Date::ITALY),10800,3600,:'GEST')}
|
130
|
-
add_period(2038,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59177459,24),0,Date::ITALY),DateTime.new0(Rational.new!(59180987,24),0,Date::ITALY),10800,0,:'GET')}
|
131
|
-
add_period(2039,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59180987,24),0,Date::ITALY),DateTime.new0(Rational.new!(59186195,24),0,Date::ITALY),10800,3600,:'GEST')}
|
132
|
-
add_period(2039,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59186195,24),0,Date::ITALY),DateTime.new0(Rational.new!(59189723,24),0,Date::ITALY),10800,0,:'GET')}
|
133
|
-
add_period(2040,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59189723,24),0,Date::ITALY),DateTime.new0(Rational.new!(59194931,24),0,Date::ITALY),10800,3600,:'GEST')}
|
134
|
-
add_period(2040,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59194931,24),0,Date::ITALY),DateTime.new0(Rational.new!(59198627,24),0,Date::ITALY),10800,0,:'GET')}
|
135
|
-
add_period(2041,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59198627,24),0,Date::ITALY),DateTime.new0(Rational.new!(59203667,24),0,Date::ITALY),10800,3600,:'GEST')}
|
136
|
-
add_period(2041,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59203667,24),0,Date::ITALY),DateTime.new0(Rational.new!(59207363,24),0,Date::ITALY),10800,0,:'GET')}
|
137
|
-
add_period(2042,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59207363,24),0,Date::ITALY),DateTime.new0(Rational.new!(59212403,24),0,Date::ITALY),10800,3600,:'GEST')}
|
138
|
-
add_period(2042,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59212403,24),0,Date::ITALY),DateTime.new0(Rational.new!(59216099,24),0,Date::ITALY),10800,0,:'GET')}
|
139
|
-
add_period(2043,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59216099,24),0,Date::ITALY),DateTime.new0(Rational.new!(59221139,24),0,Date::ITALY),10800,3600,:'GEST')}
|
140
|
-
add_period(2043,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59221139,24),0,Date::ITALY),DateTime.new0(Rational.new!(59224835,24),0,Date::ITALY),10800,0,:'GET')}
|
141
|
-
add_period(2044,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59224835,24),0,Date::ITALY),DateTime.new0(Rational.new!(59230043,24),0,Date::ITALY),10800,3600,:'GEST')}
|
142
|
-
add_period(2044,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59230043,24),0,Date::ITALY),DateTime.new0(Rational.new!(59233571,24),0,Date::ITALY),10800,0,:'GET')}
|
143
|
-
add_period(2045,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(59233571,24),0,Date::ITALY),DateTime.new0(Rational.new!(59238779,24),0,Date::ITALY),10800,3600,:'GEST')}
|
144
|
-
add_period(2045,10) {TimezonePeriod.new(DateTime.new0(Rational.new!(59238779,24),0,Date::ITALY),nil,10800,0,:'GET')}
|
63
|
+
add_period(2005,3) {TimezonePeriod.new(DateTime.new0(Rational.new!(58882955,24),0,Date::ITALY),nil,14400,0,:'GET')}
|
145
64
|
end
|
146
65
|
end
|
147
66
|
end
|
data/lib/tzinfo/timezone.rb
CHANGED
@@ -339,7 +339,8 @@ module TZInfo
|
|
339
339
|
period_for_utc(Time.now.utc)
|
340
340
|
end
|
341
341
|
|
342
|
-
# Returns the current Time and TimezonePeriod as an array.
|
342
|
+
# Returns the current Time and TimezonePeriod as an array. The first element
|
343
|
+
# is the time, the second element is the period.
|
343
344
|
def current_period_and_time
|
344
345
|
utc = Time.now.utc
|
345
346
|
[utc_to_local(utc), period_for_utc(utc)]
|
@@ -85,29 +85,32 @@ module TZInfo
|
|
85
85
|
|
86
86
|
# Returns the period for the given utc time.
|
87
87
|
# If no period is found for the given time, PeriodNotFound is thrown.
|
88
|
-
def period_for_utc(utc)
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
index.downto(0) {|i|
|
96
|
-
contents = get_contents(i)
|
88
|
+
def period_for_utc(utc)
|
89
|
+
if @list.nil?
|
90
|
+
result = nil
|
91
|
+
else
|
92
|
+
index = index_for_utc(utc.year, utc.mon)
|
93
|
+
index = 0 if index < 0
|
94
|
+
index = @list.length - 1 if index >= @list.length
|
97
95
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
96
|
+
result = nil
|
97
|
+
index.downto(0) {|i|
|
98
|
+
contents = get_contents(i)
|
99
|
+
|
100
|
+
if contents.is_a?(Array)
|
101
|
+
(contents.length - 1).downto(0) {|j|
|
102
|
+
if contents[j].valid_for_utc?(utc)
|
103
|
+
result = contents[j]
|
104
|
+
break
|
105
|
+
end
|
106
|
+
}
|
107
|
+
break unless result.nil?
|
108
|
+
elsif !contents.nil? && contents.valid_for_utc?(utc)
|
109
|
+
result = contents
|
110
|
+
break
|
111
|
+
end
|
112
|
+
}
|
113
|
+
end
|
111
114
|
|
112
115
|
if result.nil?
|
113
116
|
unbounded_start = get_unbounded_start
|
@@ -125,42 +128,42 @@ module TZInfo
|
|
125
128
|
# If no period is found for the given time, PeriodNotFound is thrown.
|
126
129
|
# Results returned are ordered by increasing UTC start date.
|
127
130
|
def periods_for_local(local)
|
128
|
-
raise PeriodNotFound, 'No periods defined' if @list.nil?
|
129
|
-
|
130
|
-
# add one to the index because the periods are indexed by UTC start
|
131
|
-
# and the period we are looking for could therefore be in the next
|
132
|
-
# half of the year
|
133
|
-
index = index_for_utc(local.year, local.mon) + 1
|
134
|
-
index = 0 if index < 0
|
135
|
-
index = @list.length - 1 if index >= @list.length
|
136
|
-
|
137
|
-
result = []
|
138
|
-
|
139
131
|
# found_first is used to avoid searching back to far
|
140
132
|
# the search will be limited at the next half year block after discovering
|
141
133
|
# the first match
|
142
134
|
found_first = nil
|
143
135
|
|
144
|
-
|
145
|
-
|
136
|
+
result = []
|
137
|
+
|
138
|
+
if !@list.nil?
|
139
|
+
# add one to the index because the periods are indexed by UTC start
|
140
|
+
# and the period we are looking for could therefore be in the next
|
141
|
+
# half of the year
|
142
|
+
index = index_for_utc(local.year, local.mon) + 1
|
143
|
+
index = 0 if index < 0
|
144
|
+
index = @list.length - 1 if index >= @list.length
|
146
145
|
|
147
|
-
|
148
|
-
|
149
|
-
if contents[j].valid_for_local?(local)
|
150
|
-
result << contents[j]
|
151
|
-
found_first = i if found_first.nil?
|
152
|
-
end
|
153
|
-
}
|
146
|
+
index.downto(0) {|i|
|
147
|
+
contents = get_contents(i)
|
154
148
|
|
155
|
-
if
|
156
|
-
|
157
|
-
|
149
|
+
if contents.is_a?(Array)
|
150
|
+
(contents.length - 1).downto(0) {|j|
|
151
|
+
if contents[j].valid_for_local?(local)
|
152
|
+
result << contents[j]
|
153
|
+
found_first = i if found_first.nil?
|
154
|
+
end
|
155
|
+
}
|
156
|
+
|
157
|
+
if !found_first.nil? && i < found_first
|
158
|
+
# searched far enough
|
159
|
+
break
|
160
|
+
end
|
161
|
+
elsif !contents.nil? && contents.valid_for_local?(local)
|
162
|
+
result << contents
|
158
163
|
end
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
}
|
163
|
-
|
164
|
+
}
|
165
|
+
end
|
166
|
+
|
164
167
|
if result.empty? || found_first == 0
|
165
168
|
unbounded_start = get_unbounded_start
|
166
169
|
result << unbounded_start if !unbounded_start.nil? && unbounded_start.valid_for_local?(local)
|
data/lib/tzinfo/tzdataparser.rb
CHANGED
@@ -76,7 +76,7 @@ module TZInfo
|
|
76
76
|
@only_zones = []
|
77
77
|
@only_countries = []
|
78
78
|
@exclude_zones = ['Asia/Riyadh87', 'Asia/Riyadh88', 'Asia/Riyadh89',
|
79
|
-
'Mideast/Riyadh87', 'Mideast/Riyadh88', 'Mideast/
|
79
|
+
'Mideast/Riyadh87', 'Mideast/Riyadh88', 'Mideast/Riyadh89']
|
80
80
|
@exclude_countries = []
|
81
81
|
end
|
82
82
|
|
@@ -268,6 +268,16 @@ class TCTimezonePeriod < Test::Unit::TestCase
|
|
268
268
|
list.periods_for_local(DateTime.new(2000,7,1,0,0,0)))
|
269
269
|
end
|
270
270
|
|
271
|
+
def test_unbounded_start_only
|
272
|
+
list = TimezonePeriodList.new
|
273
|
+
list.add_unbounded_start { TimezonePeriod.new(nil,nil,0,0,:'UTC') }
|
274
|
+
|
275
|
+
assert_period_equal(TimezonePeriod.new(nil,nil,0,0,:'UTC'),
|
276
|
+
list.period_for_utc(DateTime.new(2000,1,1,0,0,0)))
|
277
|
+
assert_periods_equal([TimezonePeriod.new(nil,nil,0,0,:'UTC')],
|
278
|
+
list.periods_for_local(DateTime.new(2000,1,1,0,0,0)))
|
279
|
+
end
|
280
|
+
|
271
281
|
private
|
272
282
|
def assert_period_equal(expected, actual)
|
273
283
|
assert_equal(expected.utc_start, actual.utc_start)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
2
|
+
require 'test/unit'
|
3
|
+
require 'tzinfo/timezone'
|
4
|
+
|
5
|
+
include TZInfo
|
6
|
+
|
7
|
+
class TCTimezoneUTC < Test::Unit::TestCase
|
8
|
+
def test_2004
|
9
|
+
tz = Timezone.get('UTC')
|
10
|
+
|
11
|
+
assert_equal(DateTime.new(2004,1,1,0,0,0), tz.utc_to_local(DateTime.new(2004,1,1,0,0,0)))
|
12
|
+
assert_equal(DateTime.new(2004,12,31,23,59,59), tz.utc_to_local(DateTime.new(2004,12,31,23,59,59)))
|
13
|
+
|
14
|
+
assert_equal(DateTime.new(2004,1,1,0,0,0), tz.local_to_utc(DateTime.new(2004,1,1,0,0,0)))
|
15
|
+
assert_equal(DateTime.new(2004,12,31,23,59,59), tz.local_to_utc(DateTime.new(2004,12,31,23,59,59)))
|
16
|
+
|
17
|
+
assert_equal(:UTC, tz.period_for_utc(DateTime.new(2004,1,1,0,0,0)).zone_identifier)
|
18
|
+
assert_equal(:UTC, tz.period_for_utc(DateTime.new(2004,12,31,23,59,59)).zone_identifier)
|
19
|
+
|
20
|
+
assert_equal(:UTC, tz.period_for_local(DateTime.new(2004,1,1,0,0,0)).zone_identifier)
|
21
|
+
assert_equal(:UTC, tz.period_for_local(DateTime.new(2004,12,31,23,59,59)).zone_identifier)
|
22
|
+
|
23
|
+
assert_equal(0, tz.period_for_utc(DateTime.new(2004,1,1,0,0,0)).utc_total_offset)
|
24
|
+
assert_equal(0, tz.period_for_utc(DateTime.new(2004,12,31,23,59,59)).utc_total_offset)
|
25
|
+
|
26
|
+
assert_equal(0, tz.period_for_local(DateTime.new(2004,1,1,0,0,0)).utc_total_offset)
|
27
|
+
assert_equal(0, tz.period_for_local(DateTime.new(2004,12,31,23,59,59)).utc_total_offset)
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: tzinfo
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2005-
|
6
|
+
version: 0.1.1
|
7
|
+
date: 2005-12-18
|
8
8
|
summary: Daylight-savings aware timezone library
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -31,7 +31,6 @@ files:
|
|
31
31
|
- doc
|
32
32
|
- lib
|
33
33
|
- LICENSE
|
34
|
-
- pkg
|
35
34
|
- Rakefile
|
36
35
|
- README
|
37
36
|
- test
|
@@ -827,19 +826,6 @@ files:
|
|
827
826
|
- lib/tzinfo/definitions/Pacific/Wake.rb
|
828
827
|
- lib/tzinfo/definitions/Pacific/Wallis.rb
|
829
828
|
- lib/tzinfo/definitions/Pacific/Yap.rb
|
830
|
-
- lib/tzinfo/definitions/SystemV/AST4.rb
|
831
|
-
- lib/tzinfo/definitions/SystemV/AST4ADT.rb
|
832
|
-
- lib/tzinfo/definitions/SystemV/CST6.rb
|
833
|
-
- lib/tzinfo/definitions/SystemV/CST6CDT.rb
|
834
|
-
- lib/tzinfo/definitions/SystemV/EST5.rb
|
835
|
-
- lib/tzinfo/definitions/SystemV/EST5EDT.rb
|
836
|
-
- lib/tzinfo/definitions/SystemV/HST10.rb
|
837
|
-
- lib/tzinfo/definitions/SystemV/MST7.rb
|
838
|
-
- lib/tzinfo/definitions/SystemV/MST7MDT.rb
|
839
|
-
- lib/tzinfo/definitions/SystemV/PST8.rb
|
840
|
-
- lib/tzinfo/definitions/SystemV/PST8PDT.rb
|
841
|
-
- lib/tzinfo/definitions/SystemV/YST9.rb
|
842
|
-
- lib/tzinfo/definitions/SystemV/YST9YDT.rb
|
843
829
|
- lib/tzinfo/definitions/US/Alaska.rb
|
844
830
|
- lib/tzinfo/definitions/US/Aleutian.rb
|
845
831
|
- lib/tzinfo/definitions/US/Arizona.rb
|
@@ -861,6 +847,7 @@ files:
|
|
861
847
|
- test/tc_timezone_period.rb
|
862
848
|
- test/tc_timezone_period_list.rb
|
863
849
|
- test/tc_timezone_proxy.rb
|
850
|
+
- test/tc_timezone_utc.rb
|
864
851
|
- test/ts_all.rb
|
865
852
|
test_files: []
|
866
853
|
rdoc_options: []
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'tzinfo/timezone'
|
2
|
-
require 'tzinfo/definitions/America/Puerto_Rico'
|
3
|
-
module TZInfo
|
4
|
-
module Definitions #:nodoc:
|
5
|
-
module SystemV #:nodoc:
|
6
|
-
class AST4 < Definitions::America::Puerto_Rico #:nodoc:
|
7
|
-
set_identifier('SystemV/AST4')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'tzinfo/timezone'
|
2
|
-
require 'tzinfo/definitions/America/Halifax'
|
3
|
-
module TZInfo
|
4
|
-
module Definitions #:nodoc:
|
5
|
-
module SystemV #:nodoc:
|
6
|
-
class AST4ADT < Definitions::America::Halifax #:nodoc:
|
7
|
-
set_identifier('SystemV/AST4ADT')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'tzinfo/timezone'
|
2
|
-
require 'tzinfo/definitions/America/Chicago'
|
3
|
-
module TZInfo
|
4
|
-
module Definitions #:nodoc:
|
5
|
-
module SystemV #:nodoc:
|
6
|
-
class CST6CDT < Definitions::America::Chicago #:nodoc:
|
7
|
-
set_identifier('SystemV/CST6CDT')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'tzinfo/timezone'
|
2
|
-
require 'tzinfo/definitions/America/Indianapolis'
|
3
|
-
module TZInfo
|
4
|
-
module Definitions #:nodoc:
|
5
|
-
module SystemV #:nodoc:
|
6
|
-
class EST5 < Definitions::America::Indianapolis #:nodoc:
|
7
|
-
set_identifier('SystemV/EST5')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'tzinfo/timezone'
|
2
|
-
require 'tzinfo/definitions/America/New_York'
|
3
|
-
module TZInfo
|
4
|
-
module Definitions #:nodoc:
|
5
|
-
module SystemV #:nodoc:
|
6
|
-
class EST5EDT < Definitions::America::New_York #:nodoc:
|
7
|
-
set_identifier('SystemV/EST5EDT')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'tzinfo/timezone'
|
2
|
-
require 'tzinfo/definitions/Pacific/Honolulu'
|
3
|
-
module TZInfo
|
4
|
-
module Definitions #:nodoc:
|
5
|
-
module SystemV #:nodoc:
|
6
|
-
class HST10 < Definitions::Pacific::Honolulu #:nodoc:
|
7
|
-
set_identifier('SystemV/HST10')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'tzinfo/timezone'
|
2
|
-
require 'tzinfo/definitions/America/Denver'
|
3
|
-
module TZInfo
|
4
|
-
module Definitions #:nodoc:
|
5
|
-
module SystemV #:nodoc:
|
6
|
-
class MST7MDT < Definitions::America::Denver #:nodoc:
|
7
|
-
set_identifier('SystemV/MST7MDT')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'tzinfo/timezone'
|
2
|
-
require 'tzinfo/definitions/Pacific/Pitcairn'
|
3
|
-
module TZInfo
|
4
|
-
module Definitions #:nodoc:
|
5
|
-
module SystemV #:nodoc:
|
6
|
-
class PST8 < Definitions::Pacific::Pitcairn #:nodoc:
|
7
|
-
set_identifier('SystemV/PST8')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|