time_crisis 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (615) hide show
  1. data/Rakefile +0 -3
  2. data/VERSION.yml +2 -2
  3. data/lib/time_crisis.rb +13 -25
  4. data/lib/time_crisis/conversions.rb +39 -0
  5. data/lib/{third_base → time_crisis}/date.rb +135 -133
  6. data/lib/{third_base → time_crisis}/datetime.rb +123 -111
  7. data/lib/time_crisis/holiday.rb +8 -6
  8. data/lib/time_crisis/meteorological_seasons.rb +3 -0
  9. data/lib/time_crisis/nth_weekday.rb +10 -15
  10. data/lib/time_crisis/support.rb +13 -8
  11. data/lib/time_crisis/support/basic_object.rb +18 -0
  12. data/lib/time_crisis/support/duration.rb +87 -0
  13. data/lib/time_crisis/support/ext/date/acts_like.rb +9 -0
  14. data/lib/time_crisis/support/ext/date/calculations.rb +183 -0
  15. data/lib/time_crisis/support/ext/date/conversions.rb +60 -0
  16. data/lib/time_crisis/support/ext/date_time/acts_like.rb +13 -0
  17. data/lib/time_crisis/support/ext/date_time/calculations.rb +88 -0
  18. data/lib/time_crisis/support/ext/date_time/conversions.rb +66 -0
  19. data/lib/time_crisis/support/ext/date_time/zones.rb +5 -0
  20. data/lib/time_crisis/support/ext/object/acts_like.rb +5 -0
  21. data/lib/time_crisis/support/ext/object/blank.rb +47 -0
  22. data/lib/time_crisis/support/ext/time/acts_like.rb +9 -0
  23. data/lib/time_crisis/support/ext/time/calculations.rb +228 -0
  24. data/lib/time_crisis/support/ext/time/conversions.rb +58 -0
  25. data/lib/time_crisis/support/ext/time/marshal_with_utc_flag.rb +21 -0
  26. data/lib/time_crisis/support/ext/time/publicize_conversion_methods.rb +9 -0
  27. data/lib/time_crisis/support/ext/time/zones.rb +44 -0
  28. data/lib/time_crisis/support/time_with_zone.rb +272 -0
  29. data/lib/time_crisis/support/values/time_zone.rb +339 -0
  30. data/lib/time_crisis/time.rb +4 -0
  31. data/lib/time_crisis/tzinfo.rb +1 -0
  32. data/lib/time_crisis/tzinfo/definitions/Africa/Abidjan.rb +18 -0
  33. data/lib/time_crisis/tzinfo/definitions/Africa/Accra.rb +33 -0
  34. data/lib/time_crisis/tzinfo/definitions/Africa/Addis_Ababa.rb +20 -0
  35. data/lib/time_crisis/tzinfo/definitions/Africa/Algiers.rb +2 -2
  36. data/lib/time_crisis/tzinfo/definitions/Africa/Asmara.rb +22 -0
  37. data/lib/time_crisis/tzinfo/definitions/Africa/Asmera.rb +13 -0
  38. data/lib/time_crisis/tzinfo/definitions/Africa/Bamako.rb +21 -0
  39. data/lib/time_crisis/tzinfo/definitions/Africa/Bangui.rb +18 -0
  40. data/lib/time_crisis/tzinfo/definitions/Africa/Banjul.rb +22 -0
  41. data/lib/time_crisis/tzinfo/definitions/Africa/Bissau.rb +20 -0
  42. data/lib/time_crisis/tzinfo/definitions/Africa/Blantyre.rb +18 -0
  43. data/lib/time_crisis/tzinfo/definitions/Africa/Brazzaville.rb +18 -0
  44. data/lib/time_crisis/tzinfo/definitions/Africa/Bujumbura.rb +18 -0
  45. data/lib/time_crisis/tzinfo/definitions/Africa/Cairo.rb +2 -2
  46. data/lib/time_crisis/tzinfo/definitions/Africa/Casablanca.rb +2 -2
  47. data/lib/time_crisis/tzinfo/definitions/Africa/Ceuta.rb +172 -0
  48. data/lib/time_crisis/tzinfo/definitions/Africa/Conakry.rb +21 -0
  49. data/lib/time_crisis/tzinfo/definitions/Africa/Dakar.rb +20 -0
  50. data/lib/time_crisis/tzinfo/definitions/Africa/Dar_es_Salaam.rb +21 -0
  51. data/lib/time_crisis/tzinfo/definitions/Africa/Djibouti.rb +18 -0
  52. data/lib/time_crisis/tzinfo/definitions/Africa/Douala.rb +18 -0
  53. data/lib/time_crisis/tzinfo/definitions/Africa/El_Aaiun.rb +20 -0
  54. data/lib/time_crisis/tzinfo/definitions/Africa/Freetown.rb +53 -0
  55. data/lib/time_crisis/tzinfo/definitions/Africa/Gaborone.rb +21 -0
  56. data/lib/time_crisis/tzinfo/definitions/Africa/Harare.rb +2 -2
  57. data/lib/time_crisis/tzinfo/definitions/Africa/Johannesburg.rb +2 -2
  58. data/lib/time_crisis/tzinfo/definitions/Africa/Kampala.rb +23 -0
  59. data/lib/time_crisis/tzinfo/definitions/Africa/Khartoum.rb +53 -0
  60. data/lib/time_crisis/tzinfo/definitions/Africa/Kigali.rb +18 -0
  61. data/lib/time_crisis/tzinfo/definitions/Africa/Kinshasa.rb +18 -0
  62. data/lib/time_crisis/tzinfo/definitions/Africa/Lagos.rb +18 -0
  63. data/lib/time_crisis/tzinfo/definitions/Africa/Libreville.rb +18 -0
  64. data/lib/time_crisis/tzinfo/definitions/Africa/Lome.rb +18 -0
  65. data/lib/time_crisis/tzinfo/definitions/Africa/Luanda.rb +20 -0
  66. data/lib/time_crisis/tzinfo/definitions/Africa/Lubumbashi.rb +18 -0
  67. data/lib/time_crisis/tzinfo/definitions/Africa/Lusaka.rb +18 -0
  68. data/lib/time_crisis/tzinfo/definitions/Africa/Malabo.rb +20 -0
  69. data/lib/time_crisis/tzinfo/definitions/Africa/Maputo.rb +18 -0
  70. data/lib/time_crisis/tzinfo/definitions/Africa/Maseru.rb +21 -0
  71. data/lib/time_crisis/tzinfo/definitions/Africa/Mbabane.rb +18 -0
  72. data/lib/time_crisis/tzinfo/definitions/Africa/Mogadishu.rb +21 -0
  73. data/lib/time_crisis/tzinfo/definitions/Africa/Monrovia.rb +2 -2
  74. data/lib/time_crisis/tzinfo/definitions/Africa/Nairobi.rb +2 -2
  75. data/lib/time_crisis/tzinfo/definitions/Africa/Ndjamena.rb +21 -0
  76. data/lib/time_crisis/tzinfo/definitions/Africa/Niamey.rb +22 -0
  77. data/lib/time_crisis/tzinfo/definitions/Africa/Nouakchott.rb +21 -0
  78. data/lib/time_crisis/tzinfo/definitions/Africa/Ouagadougou.rb +18 -0
  79. data/lib/time_crisis/tzinfo/definitions/Africa/Porto__m__Novo.rb +20 -0
  80. data/lib/time_crisis/tzinfo/definitions/Africa/Sao_Tome.rb +20 -0
  81. data/lib/time_crisis/tzinfo/definitions/Africa/Timbuktu.rb +13 -0
  82. data/lib/time_crisis/tzinfo/definitions/Africa/Tripoli.rb +48 -0
  83. data/lib/time_crisis/tzinfo/definitions/Africa/Tunis.rb +135 -0
  84. data/lib/time_crisis/tzinfo/definitions/Africa/Windhoek.rb +140 -0
  85. data/lib/time_crisis/tzinfo/definitions/America/Adak.rb +196 -0
  86. data/lib/time_crisis/tzinfo/definitions/America/Anchorage.rb +196 -0
  87. data/lib/time_crisis/tzinfo/definitions/America/Anguilla.rb +18 -0
  88. data/lib/time_crisis/tzinfo/definitions/America/Antigua.rb +20 -0
  89. data/lib/time_crisis/tzinfo/definitions/America/Araguaina.rb +67 -0
  90. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +2 -2
  91. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Catamarca.rb +85 -0
  92. data/lib/time_crisis/tzinfo/definitions/America/Argentina/ComodRivadavia.rb +15 -0
  93. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Cordoba.rb +85 -0
  94. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Jujuy.rb +84 -0
  95. data/lib/time_crisis/tzinfo/definitions/America/Argentina/La_Rioja.rb +86 -0
  96. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Mendoza.rb +86 -0
  97. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Rio_Gallegos.rb +85 -0
  98. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Salta.rb +83 -0
  99. data/lib/time_crisis/tzinfo/definitions/America/Argentina/San_Juan.rb +2 -2
  100. data/lib/time_crisis/tzinfo/definitions/America/Argentina/San_Luis.rb +168 -0
  101. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Tucuman.rb +87 -0
  102. data/lib/time_crisis/tzinfo/definitions/America/Argentina/Ushuaia.rb +85 -0
  103. data/lib/time_crisis/tzinfo/definitions/America/Aruba.rb +20 -0
  104. data/lib/time_crisis/tzinfo/definitions/America/Asuncion.rb +174 -0
  105. data/lib/time_crisis/tzinfo/definitions/America/Atikokan.rb +28 -0
  106. data/lib/time_crisis/tzinfo/definitions/America/Atka.rb +13 -0
  107. data/lib/time_crisis/tzinfo/definitions/America/Bahia.rb +77 -0
  108. data/lib/time_crisis/tzinfo/definitions/America/Barbados.rb +29 -0
  109. data/lib/time_crisis/tzinfo/definitions/America/Belem.rb +47 -0
  110. data/lib/time_crisis/tzinfo/definitions/America/Belize.rb +74 -0
  111. data/lib/time_crisis/tzinfo/definitions/America/Blanc__m__Sablon.rb +26 -0
  112. data/lib/time_crisis/tzinfo/definitions/America/Boa_Vista.rb +51 -0
  113. data/lib/time_crisis/tzinfo/definitions/America/Bogota.rb +2 -2
  114. data/lib/time_crisis/tzinfo/definitions/America/Boise.rb +199 -0
  115. data/lib/time_crisis/tzinfo/definitions/America/Buenos_Aires.rb +13 -0
  116. data/lib/time_crisis/tzinfo/definitions/America/Cambridge_Bay.rb +173 -0
  117. data/lib/time_crisis/tzinfo/definitions/America/Campo_Grande.rb +171 -0
  118. data/lib/time_crisis/tzinfo/definitions/America/Cancun.rb +133 -0
  119. data/lib/time_crisis/tzinfo/definitions/America/Caracas.rb +2 -2
  120. data/lib/time_crisis/tzinfo/definitions/America/Catamarca.rb +13 -0
  121. data/lib/time_crisis/tzinfo/definitions/America/Cayenne.rb +20 -0
  122. data/lib/time_crisis/tzinfo/definitions/America/Cayman.rb +20 -0
  123. data/lib/time_crisis/tzinfo/definitions/America/Chicago.rb +2 -2
  124. data/lib/time_crisis/tzinfo/definitions/America/Chihuahua.rb +2 -2
  125. data/lib/time_crisis/tzinfo/definitions/America/Coral_Harbour.rb +13 -0
  126. data/lib/time_crisis/tzinfo/definitions/America/Cordoba.rb +13 -0
  127. data/lib/time_crisis/tzinfo/definitions/America/Costa_Rica.rb +29 -0
  128. data/lib/time_crisis/tzinfo/definitions/America/Cuiaba.rb +169 -0
  129. data/lib/time_crisis/tzinfo/definitions/America/Curacao.rb +20 -0
  130. data/lib/time_crisis/tzinfo/definitions/America/Danmarkshavn.rb +53 -0
  131. data/lib/time_crisis/tzinfo/definitions/America/Dawson.rb +176 -0
  132. data/lib/time_crisis/tzinfo/definitions/America/Dawson_Creek.rb +79 -0
  133. data/lib/time_crisis/tzinfo/definitions/America/Denver.rb +2 -2
  134. data/lib/time_crisis/tzinfo/definitions/America/Detroit.rb +186 -0
  135. data/lib/time_crisis/tzinfo/definitions/America/Dominica.rb +18 -0
  136. data/lib/time_crisis/tzinfo/definitions/America/Edmonton.rb +200 -0
  137. data/lib/time_crisis/tzinfo/definitions/America/Eirunepe.rb +51 -0
  138. data/lib/time_crisis/tzinfo/definitions/America/El_Salvador.rb +23 -0
  139. data/lib/time_crisis/tzinfo/definitions/America/Ensenada.rb +13 -0
  140. data/lib/time_crisis/tzinfo/definitions/America/Fort_Wayne.rb +13 -0
  141. data/lib/time_crisis/tzinfo/definitions/America/Fortaleza.rb +57 -0
  142. data/lib/time_crisis/tzinfo/definitions/America/Glace_Bay.rb +186 -0
  143. data/lib/time_crisis/tzinfo/definitions/America/Godthab.rb +2 -2
  144. data/lib/time_crisis/tzinfo/definitions/America/Goose_Bay.rb +255 -0
  145. data/lib/time_crisis/tzinfo/definitions/America/Grand_Turk.rb +165 -0
  146. data/lib/time_crisis/tzinfo/definitions/America/Grenada.rb +18 -0
  147. data/lib/time_crisis/tzinfo/definitions/America/Guadeloupe.rb +18 -0
  148. data/lib/time_crisis/tzinfo/definitions/America/Guatemala.rb +2 -2
  149. data/lib/time_crisis/tzinfo/definitions/America/Guayaquil.rb +20 -0
  150. data/lib/time_crisis/tzinfo/definitions/America/Guyana.rb +24 -0
  151. data/lib/time_crisis/tzinfo/definitions/America/Halifax.rb +2 -2
  152. data/lib/time_crisis/tzinfo/definitions/America/Havana.rb +201 -0
  153. data/lib/time_crisis/tzinfo/definitions/America/Hermosillo.rb +35 -0
  154. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Indianapolis.rb +2 -2
  155. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Knox.rb +203 -0
  156. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Marengo.rb +153 -0
  157. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Petersburg.rb +166 -0
  158. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Tell_City.rb +151 -0
  159. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Vevay.rb +131 -0
  160. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Vincennes.rb +151 -0
  161. data/lib/time_crisis/tzinfo/definitions/America/Indiana/Winamac.rb +157 -0
  162. data/lib/time_crisis/tzinfo/definitions/America/Indianapolis.rb +13 -0
  163. data/lib/time_crisis/tzinfo/definitions/America/Inuvik.rb +166 -0
  164. data/lib/time_crisis/tzinfo/definitions/America/Iqaluit.rb +170 -0
  165. data/lib/time_crisis/tzinfo/definitions/America/Jamaica.rb +41 -0
  166. data/lib/time_crisis/tzinfo/definitions/America/Jujuy.rb +13 -0
  167. data/lib/time_crisis/tzinfo/definitions/America/Juneau.rb +2 -2
  168. data/lib/time_crisis/tzinfo/definitions/America/Kentucky/Louisville.rb +228 -0
  169. data/lib/time_crisis/tzinfo/definitions/America/Kentucky/Monticello.rb +198 -0
  170. data/lib/time_crisis/tzinfo/definitions/America/Knox_IN.rb +13 -0
  171. data/lib/time_crisis/tzinfo/definitions/America/La_Paz.rb +2 -2
  172. data/lib/time_crisis/tzinfo/definitions/America/Lima.rb +2 -2
  173. data/lib/time_crisis/tzinfo/definitions/America/Los_Angeles.rb +2 -2
  174. data/lib/time_crisis/tzinfo/definitions/America/Louisville.rb +13 -0
  175. data/lib/time_crisis/tzinfo/definitions/America/Maceio.rb +59 -0
  176. data/lib/time_crisis/tzinfo/definitions/America/Managua.rb +36 -0
  177. data/lib/time_crisis/tzinfo/definitions/America/Manaus.rb +49 -0
  178. data/lib/time_crisis/tzinfo/definitions/America/Marigot.rb +13 -0
  179. data/lib/time_crisis/tzinfo/definitions/America/Martinique.rb +23 -0
  180. data/lib/time_crisis/tzinfo/definitions/America/Mazatlan.rb +2 -2
  181. data/lib/time_crisis/tzinfo/definitions/America/Mendoza.rb +13 -0
  182. data/lib/time_crisis/tzinfo/definitions/America/Menominee.rb +190 -0
  183. data/lib/time_crisis/tzinfo/definitions/America/Merida.rb +132 -0
  184. data/lib/time_crisis/tzinfo/definitions/America/Mexico_City.rb +2 -2
  185. data/lib/time_crisis/tzinfo/definitions/America/Miquelon.rb +149 -0
  186. data/lib/time_crisis/tzinfo/definitions/America/Moncton.rb +254 -0
  187. data/lib/time_crisis/tzinfo/definitions/America/Monterrey.rb +2 -2
  188. data/lib/time_crisis/tzinfo/definitions/America/Montevideo.rb +179 -0
  189. data/lib/time_crisis/tzinfo/definitions/America/Montreal.rb +279 -0
  190. data/lib/time_crisis/tzinfo/definitions/America/Montserrat.rb +18 -0
  191. data/lib/time_crisis/tzinfo/definitions/America/Nassau.rb +193 -0
  192. data/lib/time_crisis/tzinfo/definitions/America/New_York.rb +2 -2
  193. data/lib/time_crisis/tzinfo/definitions/America/Nipigon.rb +181 -0
  194. data/lib/time_crisis/tzinfo/definitions/America/Nome.rb +196 -0
  195. data/lib/time_crisis/tzinfo/definitions/America/Noronha.rb +57 -0
  196. data/lib/time_crisis/tzinfo/definitions/America/North_Dakota/Center.rb +200 -0
  197. data/lib/time_crisis/tzinfo/definitions/America/North_Dakota/New_Salem.rb +200 -0
  198. data/lib/time_crisis/tzinfo/definitions/America/Panama.rb +20 -0
  199. data/lib/time_crisis/tzinfo/definitions/America/Pangnirtung.rb +173 -0
  200. data/lib/time_crisis/tzinfo/definitions/America/Paramaribo.rb +26 -0
  201. data/lib/time_crisis/tzinfo/definitions/America/Phoenix.rb +2 -2
  202. data/lib/time_crisis/tzinfo/definitions/America/Port__m__au__m__Prince.rb +55 -0
  203. data/lib/time_crisis/tzinfo/definitions/America/Port_of_Spain.rb +18 -0
  204. data/lib/time_crisis/tzinfo/definitions/America/Porto_Acre.rb +13 -0
  205. data/lib/time_crisis/tzinfo/definitions/America/Porto_Velho.rb +47 -0
  206. data/lib/time_crisis/tzinfo/definitions/America/Puerto_Rico.rb +23 -0
  207. data/lib/time_crisis/tzinfo/definitions/America/Rainy_River.rb +181 -0
  208. data/lib/time_crisis/tzinfo/definitions/America/Rankin_Inlet.rb +165 -0
  209. data/lib/time_crisis/tzinfo/definitions/America/Recife.rb +57 -0
  210. data/lib/time_crisis/tzinfo/definitions/America/Regina.rb +2 -2
  211. data/lib/time_crisis/tzinfo/definitions/America/Resolute.rb +166 -0
  212. data/lib/time_crisis/tzinfo/definitions/America/Rio_Branco.rb +49 -0
  213. data/lib/time_crisis/tzinfo/definitions/America/Rosario.rb +13 -0
  214. data/lib/time_crisis/tzinfo/definitions/America/Santarem.rb +49 -0
  215. data/lib/time_crisis/tzinfo/definitions/America/Santiago.rb +2 -2
  216. data/lib/time_crisis/tzinfo/definitions/America/Santo_Domingo.rb +38 -0
  217. data/lib/time_crisis/tzinfo/definitions/America/Sao_Paulo.rb +2 -2
  218. data/lib/time_crisis/tzinfo/definitions/America/Scoresbysund.rb +163 -0
  219. data/lib/time_crisis/tzinfo/definitions/America/Shiprock.rb +13 -0
  220. data/lib/time_crisis/tzinfo/definitions/America/St_Barthelemy.rb +13 -0
  221. data/lib/time_crisis/tzinfo/definitions/America/St_Johns.rb +2 -2
  222. data/lib/time_crisis/tzinfo/definitions/America/St_Kitts.rb +18 -0
  223. data/lib/time_crisis/tzinfo/definitions/America/St_Lucia.rb +20 -0
  224. data/lib/time_crisis/tzinfo/definitions/America/St_Thomas.rb +18 -0
  225. data/lib/time_crisis/tzinfo/definitions/America/St_Vincent.rb +20 -0
  226. data/lib/time_crisis/tzinfo/definitions/America/Swift_Current.rb +44 -0
  227. data/lib/time_crisis/tzinfo/definitions/America/Tegucigalpa.rb +25 -0
  228. data/lib/time_crisis/tzinfo/definitions/America/Thule.rb +139 -0
  229. data/lib/time_crisis/tzinfo/definitions/America/Thunder_Bay.rb +186 -0
  230. data/lib/time_crisis/tzinfo/definitions/America/Tijuana.rb +2 -2
  231. data/lib/time_crisis/tzinfo/definitions/America/Toronto.rb +279 -0
  232. data/lib/time_crisis/tzinfo/definitions/America/Tortola.rb +18 -0
  233. data/lib/time_crisis/tzinfo/definitions/America/Vancouver.rb +236 -0
  234. data/lib/time_crisis/tzinfo/definitions/America/Virgin.rb +13 -0
  235. data/lib/time_crisis/tzinfo/definitions/America/Whitehorse.rb +176 -0
  236. data/lib/time_crisis/tzinfo/definitions/America/Winnipeg.rb +232 -0
  237. data/lib/time_crisis/tzinfo/definitions/America/Yakutat.rb +193 -0
  238. data/lib/time_crisis/tzinfo/definitions/America/Yellowknife.rb +169 -0
  239. data/lib/time_crisis/tzinfo/definitions/Antarctica/Casey.rb +18 -0
  240. data/lib/time_crisis/tzinfo/definitions/Antarctica/Davis.rb +20 -0
  241. data/lib/time_crisis/tzinfo/definitions/Antarctica/DumontDUrville.rb +21 -0
  242. data/lib/time_crisis/tzinfo/definitions/Antarctica/Mawson.rb +18 -0
  243. data/lib/time_crisis/tzinfo/definitions/Antarctica/McMurdo.rb +171 -0
  244. data/lib/time_crisis/tzinfo/definitions/Antarctica/Palmer.rb +172 -0
  245. data/lib/time_crisis/tzinfo/definitions/Antarctica/Rothera.rb +18 -0
  246. data/lib/time_crisis/tzinfo/definitions/Antarctica/South_Pole.rb +13 -0
  247. data/lib/time_crisis/tzinfo/definitions/Antarctica/Syowa.rb +18 -0
  248. data/lib/time_crisis/tzinfo/definitions/Antarctica/Vostok.rb +18 -0
  249. data/lib/time_crisis/tzinfo/definitions/Arctic/Longyearbyen.rb +13 -0
  250. data/lib/time_crisis/tzinfo/definitions/Asia/Aden.rb +18 -0
  251. data/lib/time_crisis/tzinfo/definitions/Asia/Almaty.rb +2 -2
  252. data/lib/time_crisis/tzinfo/definitions/Asia/Amman.rb +163 -0
  253. data/lib/time_crisis/tzinfo/definitions/Asia/Anadyr.rb +165 -0
  254. data/lib/time_crisis/tzinfo/definitions/Asia/Aqtau.rb +75 -0
  255. data/lib/time_crisis/tzinfo/definitions/Asia/Aqtobe.rb +71 -0
  256. data/lib/time_crisis/tzinfo/definitions/Asia/Ashgabat.rb +48 -0
  257. data/lib/time_crisis/tzinfo/definitions/Asia/Ashkhabad.rb +13 -0
  258. data/lib/time_crisis/tzinfo/definitions/Asia/Baghdad.rb +2 -2
  259. data/lib/time_crisis/tzinfo/definitions/Asia/Bahrain.rb +20 -0
  260. data/lib/time_crisis/tzinfo/definitions/Asia/Baku.rb +2 -2
  261. data/lib/time_crisis/tzinfo/definitions/Asia/Bangkok.rb +2 -2
  262. data/lib/time_crisis/tzinfo/definitions/Asia/Beirut.rb +185 -0
  263. data/lib/time_crisis/tzinfo/definitions/Asia/Bishkek.rb +75 -0
  264. data/lib/time_crisis/tzinfo/definitions/Asia/Brunei.rb +20 -0
  265. data/lib/time_crisis/tzinfo/definitions/Asia/Calcutta.rb +13 -0
  266. data/lib/time_crisis/tzinfo/definitions/Asia/Choibalsan.rb +68 -0
  267. data/lib/time_crisis/tzinfo/definitions/Asia/Chongqing.rb +2 -2
  268. data/lib/time_crisis/tzinfo/definitions/Asia/Chungking.rb +13 -0
  269. data/lib/time_crisis/tzinfo/definitions/Asia/Colombo.rb +2 -2
  270. data/lib/time_crisis/tzinfo/definitions/Asia/Dacca.rb +13 -0
  271. data/lib/time_crisis/tzinfo/definitions/Asia/Damascus.rb +195 -0
  272. data/lib/time_crisis/tzinfo/definitions/Asia/Dhaka.rb +2 -2
  273. data/lib/time_crisis/tzinfo/definitions/Asia/Dili.rb +25 -0
  274. data/lib/time_crisis/tzinfo/definitions/Asia/Dubai.rb +18 -0
  275. data/lib/time_crisis/tzinfo/definitions/Asia/Dushanbe.rb +45 -0
  276. data/lib/time_crisis/tzinfo/definitions/Asia/Gaza.rb +191 -0
  277. data/lib/time_crisis/tzinfo/definitions/Asia/Harbin.rb +37 -0
  278. data/lib/time_crisis/tzinfo/definitions/Asia/Ho_Chi_Minh.rb +23 -0
  279. data/lib/time_crisis/tzinfo/definitions/Asia/Hong_Kong.rb +2 -2
  280. data/lib/time_crisis/tzinfo/definitions/Asia/Hovd.rb +65 -0
  281. data/lib/time_crisis/tzinfo/definitions/Asia/Irkutsk.rb +2 -2
  282. data/lib/time_crisis/tzinfo/definitions/Asia/Istanbul.rb +13 -0
  283. data/lib/time_crisis/tzinfo/definitions/Asia/Jakarta.rb +2 -2
  284. data/lib/time_crisis/tzinfo/definitions/Asia/Jayapura.rb +21 -0
  285. data/lib/time_crisis/tzinfo/definitions/Asia/Jerusalem.rb +2 -2
  286. data/lib/time_crisis/tzinfo/definitions/Asia/Kabul.rb +2 -2
  287. data/lib/time_crisis/tzinfo/definitions/Asia/Kamchatka.rb +2 -2
  288. data/lib/time_crisis/tzinfo/definitions/Asia/Karachi.rb +2 -2
  289. data/lib/time_crisis/tzinfo/definitions/Asia/Kashgar.rb +35 -0
  290. data/lib/time_crisis/tzinfo/definitions/Asia/Kathmandu.rb +2 -2
  291. data/lib/time_crisis/tzinfo/definitions/Asia/Katmandu.rb +13 -0
  292. data/lib/time_crisis/tzinfo/definitions/Asia/Kolkata.rb +2 -2
  293. data/lib/time_crisis/tzinfo/definitions/Asia/Krasnoyarsk.rb +2 -2
  294. data/lib/time_crisis/tzinfo/definitions/Asia/Kuala_Lumpur.rb +2 -2
  295. data/lib/time_crisis/tzinfo/definitions/Asia/Kuching.rb +40 -0
  296. data/lib/time_crisis/tzinfo/definitions/Asia/Kuwait.rb +2 -2
  297. data/lib/time_crisis/tzinfo/definitions/Asia/Macao.rb +13 -0
  298. data/lib/time_crisis/tzinfo/definitions/Asia/Macau.rb +61 -0
  299. data/lib/time_crisis/tzinfo/definitions/Asia/Magadan.rb +2 -2
  300. data/lib/time_crisis/tzinfo/definitions/Asia/Makassar.rb +23 -0
  301. data/lib/time_crisis/tzinfo/definitions/Asia/Manila.rb +30 -0
  302. data/lib/time_crisis/tzinfo/definitions/Asia/Muscat.rb +2 -2
  303. data/lib/time_crisis/tzinfo/definitions/Asia/Nicosia.rb +171 -0
  304. data/lib/time_crisis/tzinfo/definitions/Asia/Novosibirsk.rb +2 -2
  305. data/lib/time_crisis/tzinfo/definitions/Asia/Omsk.rb +163 -0
  306. data/lib/time_crisis/tzinfo/definitions/Asia/Oral.rb +74 -0
  307. data/lib/time_crisis/tzinfo/definitions/Asia/Phnom_Penh.rb +23 -0
  308. data/lib/time_crisis/tzinfo/definitions/Asia/Pontianak.rb +30 -0
  309. data/lib/time_crisis/tzinfo/definitions/Asia/Pyongyang.rb +25 -0
  310. data/lib/time_crisis/tzinfo/definitions/Asia/Qatar.rb +20 -0
  311. data/lib/time_crisis/tzinfo/definitions/Asia/Qyzylorda.rb +73 -0
  312. data/lib/time_crisis/tzinfo/definitions/Asia/Rangoon.rb +2 -2
  313. data/lib/time_crisis/tzinfo/definitions/Asia/Riyadh.rb +2 -2
  314. data/lib/time_crisis/tzinfo/definitions/Asia/Riyadh87.rb +592 -0
  315. data/lib/time_crisis/tzinfo/definitions/Asia/Riyadh88.rb +582 -0
  316. data/lib/time_crisis/tzinfo/definitions/Asia/Riyadh89.rb +582 -0
  317. data/lib/time_crisis/tzinfo/definitions/Asia/Saigon.rb +13 -0
  318. data/lib/time_crisis/tzinfo/definitions/Asia/Sakhalin.rb +166 -0
  319. data/lib/time_crisis/tzinfo/definitions/Asia/Samarkand.rb +47 -0
  320. data/lib/time_crisis/tzinfo/definitions/Asia/Seoul.rb +2 -2
  321. data/lib/time_crisis/tzinfo/definitions/Asia/Shanghai.rb +2 -2
  322. data/lib/time_crisis/tzinfo/definitions/Asia/Singapore.rb +2 -2
  323. data/lib/time_crisis/tzinfo/definitions/Asia/Taipei.rb +2 -2
  324. data/lib/time_crisis/tzinfo/definitions/Asia/Tashkent.rb +2 -2
  325. data/lib/time_crisis/tzinfo/definitions/Asia/Tbilisi.rb +2 -2
  326. data/lib/time_crisis/tzinfo/definitions/Asia/Tehran.rb +2 -2
  327. data/lib/time_crisis/tzinfo/definitions/Asia/Tel_Aviv.rb +13 -0
  328. data/lib/time_crisis/tzinfo/definitions/Asia/Thimbu.rb +13 -0
  329. data/lib/time_crisis/tzinfo/definitions/Asia/Thimphu.rb +20 -0
  330. data/lib/time_crisis/tzinfo/definitions/Asia/Tokyo.rb +2 -2
  331. data/lib/time_crisis/tzinfo/definitions/Asia/Ujung_Pandang.rb +13 -0
  332. data/lib/time_crisis/tzinfo/definitions/Asia/Ulaanbaatar.rb +2 -2
  333. data/lib/time_crisis/tzinfo/definitions/Asia/Ulan_Bator.rb +13 -0
  334. data/lib/time_crisis/tzinfo/definitions/Asia/Urumqi.rb +2 -2
  335. data/lib/time_crisis/tzinfo/definitions/Asia/Vientiane.rb +23 -0
  336. data/lib/time_crisis/tzinfo/definitions/Asia/Vladivostok.rb +2 -2
  337. data/lib/time_crisis/tzinfo/definitions/Asia/Yakutsk.rb +2 -2
  338. data/lib/time_crisis/tzinfo/definitions/Asia/Yekaterinburg.rb +2 -2
  339. data/lib/time_crisis/tzinfo/definitions/Asia/Yerevan.rb +2 -2
  340. data/lib/time_crisis/tzinfo/definitions/Atlantic/Azores.rb +2 -2
  341. data/lib/time_crisis/tzinfo/definitions/Atlantic/Bermuda.rb +173 -0
  342. data/lib/time_crisis/tzinfo/definitions/Atlantic/Canary.rb +163 -0
  343. data/lib/time_crisis/tzinfo/definitions/Atlantic/Cape_Verde.rb +2 -2
  344. data/lib/time_crisis/tzinfo/definitions/Atlantic/Faeroe.rb +13 -0
  345. data/lib/time_crisis/tzinfo/definitions/Atlantic/Faroe.rb +159 -0
  346. data/lib/time_crisis/tzinfo/definitions/Atlantic/Jan_Mayen.rb +13 -0
  347. data/lib/time_crisis/tzinfo/definitions/Atlantic/Madeira.rb +269 -0
  348. data/lib/time_crisis/tzinfo/definitions/Atlantic/Reykjavik.rb +85 -0
  349. data/lib/time_crisis/tzinfo/definitions/Atlantic/South_Georgia.rb +2 -2
  350. data/lib/time_crisis/tzinfo/definitions/Atlantic/St_Helena.rb +20 -0
  351. data/lib/time_crisis/tzinfo/definitions/Atlantic/Stanley.rb +170 -0
  352. data/lib/time_crisis/tzinfo/definitions/Australia/ACT.rb +13 -0
  353. data/lib/time_crisis/tzinfo/definitions/Australia/Adelaide.rb +2 -2
  354. data/lib/time_crisis/tzinfo/definitions/Australia/Brisbane.rb +2 -2
  355. data/lib/time_crisis/tzinfo/definitions/Australia/Broken_Hill.rb +189 -0
  356. data/lib/time_crisis/tzinfo/definitions/Australia/Canberra.rb +13 -0
  357. data/lib/time_crisis/tzinfo/definitions/Australia/Currie.rb +185 -0
  358. data/lib/time_crisis/tzinfo/definitions/Australia/Darwin.rb +2 -2
  359. data/lib/time_crisis/tzinfo/definitions/Australia/Eucla.rb +37 -0
  360. data/lib/time_crisis/tzinfo/definitions/Australia/Hobart.rb +2 -2
  361. data/lib/time_crisis/tzinfo/definitions/Australia/LHI.rb +13 -0
  362. data/lib/time_crisis/tzinfo/definitions/Australia/Lindeman.rb +39 -0
  363. data/lib/time_crisis/tzinfo/definitions/Australia/Lord_Howe.rb +160 -0
  364. data/lib/time_crisis/tzinfo/definitions/Australia/Melbourne.rb +2 -2
  365. data/lib/time_crisis/tzinfo/definitions/Australia/NSW.rb +13 -0
  366. data/lib/time_crisis/tzinfo/definitions/Australia/North.rb +13 -0
  367. data/lib/time_crisis/tzinfo/definitions/Australia/Perth.rb +2 -2
  368. data/lib/time_crisis/tzinfo/definitions/Australia/Queensland.rb +13 -0
  369. data/lib/time_crisis/tzinfo/definitions/Australia/South.rb +13 -0
  370. data/lib/time_crisis/tzinfo/definitions/Australia/Sydney.rb +2 -2
  371. data/lib/time_crisis/tzinfo/definitions/Australia/Tasmania.rb +13 -0
  372. data/lib/time_crisis/tzinfo/definitions/Australia/Victoria.rb +13 -0
  373. data/lib/time_crisis/tzinfo/definitions/Australia/West.rb +13 -0
  374. data/lib/time_crisis/tzinfo/definitions/Australia/Yancowinna.rb +13 -0
  375. data/lib/time_crisis/tzinfo/definitions/Brazil/Acre.rb +13 -0
  376. data/lib/time_crisis/tzinfo/definitions/Brazil/DeNoronha.rb +13 -0
  377. data/lib/time_crisis/tzinfo/definitions/Brazil/East.rb +13 -0
  378. data/lib/time_crisis/tzinfo/definitions/Brazil/West.rb +13 -0
  379. data/lib/time_crisis/tzinfo/definitions/CET.rb +177 -0
  380. data/lib/time_crisis/tzinfo/definitions/CST6CDT.rb +192 -0
  381. data/lib/time_crisis/tzinfo/definitions/Canada/Atlantic.rb +13 -0
  382. data/lib/time_crisis/tzinfo/definitions/Canada/Central.rb +13 -0
  383. data/lib/time_crisis/tzinfo/definitions/Canada/East__m__Saskatchewan.rb +13 -0
  384. data/lib/time_crisis/tzinfo/definitions/Canada/Eastern.rb +13 -0
  385. data/lib/time_crisis/tzinfo/definitions/Canada/Mountain.rb +13 -0
  386. data/lib/time_crisis/tzinfo/definitions/Canada/Newfoundland.rb +13 -0
  387. data/lib/time_crisis/tzinfo/definitions/Canada/Pacific.rb +13 -0
  388. data/lib/time_crisis/tzinfo/definitions/Canada/Saskatchewan.rb +13 -0
  389. data/lib/time_crisis/tzinfo/definitions/Canada/Yukon.rb +13 -0
  390. data/lib/time_crisis/tzinfo/definitions/Chile/Continental.rb +13 -0
  391. data/lib/time_crisis/tzinfo/definitions/Chile/EasterIsland.rb +13 -0
  392. data/lib/time_crisis/tzinfo/definitions/Cuba.rb +11 -0
  393. data/lib/time_crisis/tzinfo/definitions/EET.rb +163 -0
  394. data/lib/time_crisis/tzinfo/definitions/EST.rb +14 -0
  395. data/lib/time_crisis/tzinfo/definitions/EST5EDT.rb +192 -0
  396. data/lib/time_crisis/tzinfo/definitions/Egypt.rb +11 -0
  397. data/lib/time_crisis/tzinfo/definitions/Eire.rb +11 -0
  398. data/lib/time_crisis/tzinfo/definitions/Etc/GMT.rb +16 -0
  399. data/lib/time_crisis/tzinfo/definitions/Etc/GMT0.rb +13 -0
  400. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__0.rb +13 -0
  401. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__1.rb +16 -0
  402. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__10.rb +16 -0
  403. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__11.rb +16 -0
  404. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__12.rb +16 -0
  405. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__13.rb +16 -0
  406. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__14.rb +16 -0
  407. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__2.rb +16 -0
  408. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__3.rb +16 -0
  409. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__4.rb +16 -0
  410. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__5.rb +16 -0
  411. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__6.rb +16 -0
  412. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__7.rb +16 -0
  413. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__8.rb +16 -0
  414. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__m__9.rb +16 -0
  415. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__0.rb +13 -0
  416. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__1.rb +16 -0
  417. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__10.rb +16 -0
  418. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__11.rb +16 -0
  419. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__12.rb +16 -0
  420. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__2.rb +16 -0
  421. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__3.rb +16 -0
  422. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__4.rb +16 -0
  423. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__5.rb +16 -0
  424. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__6.rb +16 -0
  425. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__7.rb +16 -0
  426. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__8.rb +16 -0
  427. data/lib/time_crisis/tzinfo/definitions/Etc/GMT__p__9.rb +16 -0
  428. data/lib/time_crisis/tzinfo/definitions/Etc/Greenwich.rb +13 -0
  429. data/lib/time_crisis/tzinfo/definitions/Etc/UCT.rb +16 -0
  430. data/lib/time_crisis/tzinfo/definitions/Etc/UTC.rb +2 -2
  431. data/lib/time_crisis/tzinfo/definitions/Etc/Universal.rb +13 -0
  432. data/lib/time_crisis/tzinfo/definitions/Etc/Zulu.rb +13 -0
  433. data/lib/time_crisis/tzinfo/definitions/Europe/Amsterdam.rb +2 -2
  434. data/lib/time_crisis/tzinfo/definitions/Europe/Andorra.rb +153 -0
  435. data/lib/time_crisis/tzinfo/definitions/Europe/Athens.rb +2 -2
  436. data/lib/time_crisis/tzinfo/definitions/Europe/Belfast.rb +13 -0
  437. data/lib/time_crisis/tzinfo/definitions/Europe/Belgrade.rb +2 -2
  438. data/lib/time_crisis/tzinfo/definitions/Europe/Berlin.rb +2 -2
  439. data/lib/time_crisis/tzinfo/definitions/Europe/Bratislava.rb +1 -1
  440. data/lib/time_crisis/tzinfo/definitions/Europe/Brussels.rb +2 -2
  441. data/lib/time_crisis/tzinfo/definitions/Europe/Bucharest.rb +2 -2
  442. data/lib/time_crisis/tzinfo/definitions/Europe/Budapest.rb +2 -2
  443. data/lib/time_crisis/tzinfo/definitions/Europe/Chisinau.rb +189 -0
  444. data/lib/time_crisis/tzinfo/definitions/Europe/Copenhagen.rb +2 -2
  445. data/lib/time_crisis/tzinfo/definitions/Europe/Dublin.rb +2 -2
  446. data/lib/time_crisis/tzinfo/definitions/Europe/Gibraltar.rb +245 -0
  447. data/lib/time_crisis/tzinfo/definitions/Europe/Guernsey.rb +13 -0
  448. data/lib/time_crisis/tzinfo/definitions/Europe/Helsinki.rb +2 -2
  449. data/lib/time_crisis/tzinfo/definitions/Europe/Isle_of_Man.rb +13 -0
  450. data/lib/time_crisis/tzinfo/definitions/Europe/Istanbul.rb +2 -2
  451. data/lib/time_crisis/tzinfo/definitions/Europe/Jersey.rb +13 -0
  452. data/lib/time_crisis/tzinfo/definitions/Europe/Kaliningrad.rb +181 -0
  453. data/lib/time_crisis/tzinfo/definitions/Europe/Kiev.rb +2 -2
  454. data/lib/time_crisis/tzinfo/definitions/Europe/Lisbon.rb +2 -2
  455. data/lib/time_crisis/tzinfo/definitions/Europe/Ljubljana.rb +1 -1
  456. data/lib/time_crisis/tzinfo/definitions/Europe/London.rb +2 -2
  457. data/lib/time_crisis/tzinfo/definitions/Europe/Luxembourg.rb +231 -0
  458. data/lib/time_crisis/tzinfo/definitions/Europe/Madrid.rb +2 -2
  459. data/lib/time_crisis/tzinfo/definitions/Europe/Malta.rb +213 -0
  460. data/lib/time_crisis/tzinfo/definitions/Europe/Mariehamn.rb +13 -0
  461. data/lib/time_crisis/tzinfo/definitions/Europe/Minsk.rb +2 -2
  462. data/lib/time_crisis/tzinfo/definitions/Europe/Monaco.rb +233 -0
  463. data/lib/time_crisis/tzinfo/definitions/Europe/Moscow.rb +2 -2
  464. data/lib/time_crisis/tzinfo/definitions/Europe/Nicosia.rb +13 -0
  465. data/lib/time_crisis/tzinfo/definitions/Europe/Oslo.rb +185 -0
  466. data/lib/time_crisis/tzinfo/definitions/Europe/Paris.rb +2 -2
  467. data/lib/time_crisis/tzinfo/definitions/Europe/Podgorica.rb +13 -0
  468. data/lib/time_crisis/tzinfo/definitions/Europe/Prague.rb +2 -2
  469. data/lib/time_crisis/tzinfo/definitions/Europe/Riga.rb +2 -2
  470. data/lib/time_crisis/tzinfo/definitions/Europe/Rome.rb +2 -2
  471. data/lib/time_crisis/tzinfo/definitions/Europe/Samara.rb +168 -0
  472. data/lib/time_crisis/tzinfo/definitions/Europe/San_Marino.rb +13 -0
  473. data/lib/time_crisis/tzinfo/definitions/Europe/Sarajevo.rb +1 -1
  474. data/lib/time_crisis/tzinfo/definitions/Europe/Simferopol.rb +170 -0
  475. data/lib/time_crisis/tzinfo/definitions/Europe/Skopje.rb +1 -1
  476. data/lib/time_crisis/tzinfo/definitions/Europe/Sofia.rb +2 -2
  477. data/lib/time_crisis/tzinfo/definitions/Europe/Stockholm.rb +2 -2
  478. data/lib/time_crisis/tzinfo/definitions/Europe/Tallinn.rb +2 -2
  479. data/lib/time_crisis/tzinfo/definitions/Europe/Tirane.rb +177 -0
  480. data/lib/time_crisis/tzinfo/definitions/Europe/Tiraspol.rb +13 -0
  481. data/lib/time_crisis/tzinfo/definitions/Europe/Uzhgorod.rb +168 -0
  482. data/lib/time_crisis/tzinfo/definitions/Europe/Vaduz.rb +159 -0
  483. data/lib/time_crisis/tzinfo/definitions/Europe/Vatican.rb +13 -0
  484. data/lib/time_crisis/tzinfo/definitions/Europe/Vienna.rb +2 -2
  485. data/lib/time_crisis/tzinfo/definitions/Europe/Vilnius.rb +2 -2
  486. data/lib/time_crisis/tzinfo/definitions/Europe/Volgograd.rb +166 -0
  487. data/lib/time_crisis/tzinfo/definitions/Europe/Warsaw.rb +2 -2
  488. data/lib/time_crisis/tzinfo/definitions/Europe/Zagreb.rb +1 -1
  489. data/lib/time_crisis/tzinfo/definitions/Europe/Zaporozhye.rb +171 -0
  490. data/lib/time_crisis/tzinfo/definitions/Europe/Zurich.rb +165 -0
  491. data/lib/time_crisis/tzinfo/definitions/GB.rb +11 -0
  492. data/lib/time_crisis/tzinfo/definitions/GB__m__Eire.rb +11 -0
  493. data/lib/time_crisis/tzinfo/definitions/GMT.rb +11 -0
  494. data/lib/time_crisis/tzinfo/definitions/GMT0.rb +11 -0
  495. data/lib/time_crisis/tzinfo/definitions/GMT__m__0.rb +11 -0
  496. data/lib/time_crisis/tzinfo/definitions/GMT__p__0.rb +11 -0
  497. data/lib/time_crisis/tzinfo/definitions/Greenwich.rb +11 -0
  498. data/lib/time_crisis/tzinfo/definitions/HST.rb +14 -0
  499. data/lib/time_crisis/tzinfo/definitions/Hongkong.rb +11 -0
  500. data/lib/time_crisis/tzinfo/definitions/Iceland.rb +11 -0
  501. data/lib/time_crisis/tzinfo/definitions/Indian/Antananarivo.rb +21 -0
  502. data/lib/time_crisis/tzinfo/definitions/Indian/Chagos.rb +20 -0
  503. data/lib/time_crisis/tzinfo/definitions/Indian/Christmas.rb +18 -0
  504. data/lib/time_crisis/tzinfo/definitions/Indian/Cocos.rb +18 -0
  505. data/lib/time_crisis/tzinfo/definitions/Indian/Comoro.rb +18 -0
  506. data/lib/time_crisis/tzinfo/definitions/Indian/Kerguelen.rb +18 -0
  507. data/lib/time_crisis/tzinfo/definitions/Indian/Mahe.rb +18 -0
  508. data/lib/time_crisis/tzinfo/definitions/Indian/Maldives.rb +20 -0
  509. data/lib/time_crisis/tzinfo/definitions/Indian/Mauritius.rb +23 -0
  510. data/lib/time_crisis/tzinfo/definitions/Indian/Mayotte.rb +18 -0
  511. data/lib/time_crisis/tzinfo/definitions/Indian/Reunion.rb +18 -0
  512. data/lib/time_crisis/tzinfo/definitions/Iran.rb +11 -0
  513. data/lib/time_crisis/tzinfo/definitions/Israel.rb +11 -0
  514. data/lib/time_crisis/tzinfo/definitions/Jamaica.rb +11 -0
  515. data/lib/time_crisis/tzinfo/definitions/Japan.rb +11 -0
  516. data/lib/time_crisis/tzinfo/definitions/Kwajalein.rb +11 -0
  517. data/lib/time_crisis/tzinfo/definitions/Libya.rb +11 -0
  518. data/lib/time_crisis/tzinfo/definitions/MET.rb +177 -0
  519. data/lib/time_crisis/tzinfo/definitions/MST.rb +14 -0
  520. data/lib/time_crisis/tzinfo/definitions/MST7MDT.rb +192 -0
  521. data/lib/time_crisis/tzinfo/definitions/Mexico/BajaNorte.rb +13 -0
  522. data/lib/time_crisis/tzinfo/definitions/Mexico/BajaSur.rb +13 -0
  523. data/lib/time_crisis/tzinfo/definitions/Mexico/General.rb +13 -0
  524. data/lib/time_crisis/tzinfo/definitions/Mideast/Riyadh87.rb +13 -0
  525. data/lib/time_crisis/tzinfo/definitions/Mideast/Riyadh88.rb +13 -0
  526. data/lib/time_crisis/tzinfo/definitions/Mideast/Riyadh89.rb +13 -0
  527. data/lib/time_crisis/tzinfo/definitions/NZ.rb +11 -0
  528. data/lib/time_crisis/tzinfo/definitions/NZ__m__CHAT.rb +11 -0
  529. data/lib/time_crisis/tzinfo/definitions/Navajo.rb +11 -0
  530. data/lib/time_crisis/tzinfo/definitions/PRC.rb +11 -0
  531. data/lib/time_crisis/tzinfo/definitions/PST8PDT.rb +192 -0
  532. data/lib/time_crisis/tzinfo/definitions/Pacific/Apia.rb +25 -0
  533. data/lib/time_crisis/tzinfo/definitions/Pacific/Auckland.rb +2 -2
  534. data/lib/time_crisis/tzinfo/definitions/Pacific/Chatham.rb +171 -0
  535. data/lib/time_crisis/tzinfo/definitions/Pacific/Easter.rb +190 -0
  536. data/lib/time_crisis/tzinfo/definitions/Pacific/Efate.rb +39 -0
  537. data/lib/time_crisis/tzinfo/definitions/Pacific/Enderbury.rb +22 -0
  538. data/lib/time_crisis/tzinfo/definitions/Pacific/Fakaofo.rb +18 -0
  539. data/lib/time_crisis/tzinfo/definitions/Pacific/Fiji.rb +2 -2
  540. data/lib/time_crisis/tzinfo/definitions/Pacific/Funafuti.rb +18 -0
  541. data/lib/time_crisis/tzinfo/definitions/Pacific/Galapagos.rb +20 -0
  542. data/lib/time_crisis/tzinfo/definitions/Pacific/Gambier.rb +18 -0
  543. data/lib/time_crisis/tzinfo/definitions/Pacific/Guadalcanal.rb +18 -0
  544. data/lib/time_crisis/tzinfo/definitions/Pacific/Guam.rb +2 -2
  545. data/lib/time_crisis/tzinfo/definitions/Pacific/Honolulu.rb +2 -2
  546. data/lib/time_crisis/tzinfo/definitions/Pacific/Johnston.rb +16 -0
  547. data/lib/time_crisis/tzinfo/definitions/Pacific/Kiritimati.rb +22 -0
  548. data/lib/time_crisis/tzinfo/definitions/Pacific/Kosrae.rb +21 -0
  549. data/lib/time_crisis/tzinfo/definitions/Pacific/Kwajalein.rb +22 -0
  550. data/lib/time_crisis/tzinfo/definitions/Pacific/Majuro.rb +2 -2
  551. data/lib/time_crisis/tzinfo/definitions/Pacific/Marquesas.rb +18 -0
  552. data/lib/time_crisis/tzinfo/definitions/Pacific/Midway.rb +2 -2
  553. data/lib/time_crisis/tzinfo/definitions/Pacific/Nauru.rb +23 -0
  554. data/lib/time_crisis/tzinfo/definitions/Pacific/Niue.rb +22 -0
  555. data/lib/time_crisis/tzinfo/definitions/Pacific/Norfolk.rb +20 -0
  556. data/lib/time_crisis/tzinfo/definitions/Pacific/Noumea.rb +2 -2
  557. data/lib/time_crisis/tzinfo/definitions/Pacific/Pago_Pago.rb +2 -2
  558. data/lib/time_crisis/tzinfo/definitions/Pacific/Palau.rb +18 -0
  559. data/lib/time_crisis/tzinfo/definitions/Pacific/Pitcairn.rb +20 -0
  560. data/lib/time_crisis/tzinfo/definitions/Pacific/Ponape.rb +18 -0
  561. data/lib/time_crisis/tzinfo/definitions/Pacific/Port_Moresby.rb +2 -2
  562. data/lib/time_crisis/tzinfo/definitions/Pacific/Rarotonga.rb +46 -0
  563. data/lib/time_crisis/tzinfo/definitions/Pacific/Saipan.rb +24 -0
  564. data/lib/time_crisis/tzinfo/definitions/Pacific/Samoa.rb +13 -0
  565. data/lib/time_crisis/tzinfo/definitions/Pacific/Tahiti.rb +18 -0
  566. data/lib/time_crisis/tzinfo/definitions/Pacific/Tarawa.rb +18 -0
  567. data/lib/time_crisis/tzinfo/definitions/Pacific/Tongatapu.rb +2 -2
  568. data/lib/time_crisis/tzinfo/definitions/Pacific/Truk.rb +18 -0
  569. data/lib/time_crisis/tzinfo/definitions/Pacific/Wake.rb +18 -0
  570. data/lib/time_crisis/tzinfo/definitions/Pacific/Wallis.rb +18 -0
  571. data/lib/time_crisis/tzinfo/definitions/Pacific/Yap.rb +13 -0
  572. data/lib/time_crisis/tzinfo/definitions/Poland.rb +11 -0
  573. data/lib/time_crisis/tzinfo/definitions/Portugal.rb +11 -0
  574. data/lib/time_crisis/tzinfo/definitions/ROC.rb +11 -0
  575. data/lib/time_crisis/tzinfo/definitions/ROK.rb +11 -0
  576. data/lib/time_crisis/tzinfo/definitions/Singapore.rb +11 -0
  577. data/lib/time_crisis/tzinfo/definitions/Turkey.rb +11 -0
  578. data/lib/time_crisis/tzinfo/definitions/UCT.rb +11 -0
  579. data/lib/time_crisis/tzinfo/definitions/US/Alaska.rb +13 -0
  580. data/lib/time_crisis/tzinfo/definitions/US/Aleutian.rb +13 -0
  581. data/lib/time_crisis/tzinfo/definitions/US/Arizona.rb +13 -0
  582. data/lib/time_crisis/tzinfo/definitions/US/Central.rb +13 -0
  583. data/lib/time_crisis/tzinfo/definitions/US/East__m__Indiana.rb +13 -0
  584. data/lib/time_crisis/tzinfo/definitions/US/Eastern.rb +13 -0
  585. data/lib/time_crisis/tzinfo/definitions/US/Hawaii.rb +13 -0
  586. data/lib/time_crisis/tzinfo/definitions/US/Indiana__m__Starke.rb +13 -0
  587. data/lib/time_crisis/tzinfo/definitions/US/Michigan.rb +13 -0
  588. data/lib/time_crisis/tzinfo/definitions/US/Mountain.rb +13 -0
  589. data/lib/time_crisis/tzinfo/definitions/US/Pacific.rb +13 -0
  590. data/lib/time_crisis/tzinfo/definitions/US/Pacific__m__New.rb +13 -0
  591. data/lib/time_crisis/tzinfo/definitions/US/Samoa.rb +13 -0
  592. data/lib/time_crisis/tzinfo/definitions/UTC.rb +11 -0
  593. data/lib/time_crisis/tzinfo/definitions/Universal.rb +11 -0
  594. data/lib/time_crisis/tzinfo/definitions/WET.rb +163 -0
  595. data/lib/time_crisis/tzinfo/definitions/W__m__SU.rb +11 -0
  596. data/lib/time_crisis/tzinfo/definitions/Zulu.rb +11 -0
  597. data/lib/time_crisis/tzinfo/indexes/timezones.rb +577 -0
  598. data/lib/time_crisis/tzinfo/time_or_datetime.rb +60 -22
  599. data/lib/time_crisis/tzinfo/timezone_index_definition.rb +50 -0
  600. data/lib/time_crisis/tzinfo/timezone_period.rb +4 -4
  601. data/lib/time_crisis/tzinfo/timezone_proxy.rb +65 -0
  602. data/lib/time_crisis/weekend.rb +2 -1
  603. data/time_crisis.gemspec +469 -20
  604. metadata +471 -35
  605. data/lib/third_base.rb +0 -2
  606. data/lib/third_base/compat.rb +0 -405
  607. data/lib/third_base/compat/date.rb +0 -3
  608. data/lib/third_base/compat/date/format.rb +0 -3
  609. data/lib/time_crisis/ext.rb +0 -60
  610. data/lib/time_crisis/support/acts_like.rb +0 -20
  611. data/lib/time_crisis/support/advance.rb +0 -25
  612. data/lib/time_crisis/support/change.rb +0 -47
  613. data/lib/time_crisis/support/conversions.rb +0 -98
  614. data/lib/time_crisis/support/current.rb +0 -16
  615. data/lib/time_crisis/support/readable_inspect.rb +0 -30
@@ -0,0 +1,58 @@
1
+ require 'time_crisis/support/values/time_zone'
2
+
3
+ module TimeCrisis
4
+ class Time
5
+ DATE_FORMATS = {
6
+ :db => "%Y-%m-%d %H:%M:%S",
7
+ :number => "%Y%m%d%H%M%S",
8
+ :time => "%H:%M",
9
+ :short => "%d %b %H:%M",
10
+ :long => "%B %d, %Y %H:%M",
11
+ :rfc822 => lambda { |time| time.strftime("%a, %d %b %Y %H:%M:%S #{time.formatted_offset(false)}") }
12
+ }
13
+
14
+ def to_formatted_s(format = :default)
15
+ if formatter = DATE_FORMATS[format]
16
+ formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
17
+ else
18
+ to_default_s
19
+ end
20
+ end
21
+ alias_method :to_default_s, :to_s
22
+ alias_method :to_s, :to_formatted_s
23
+
24
+ def formatted_offset(colon = true, alternate_utc_string = nil)
25
+ utc? && alternate_utc_string || TimeCrisis::TimeZone.seconds_to_utc_offset(utc_offset, colon)
26
+ end
27
+
28
+ def readable_inspect
29
+ "#<TimeCrisis::Time #{self.to_s(:rfc822)}>"
30
+ end
31
+ alias_method :default_inspect, :inspect
32
+ alias_method :inspect, :readable_inspect
33
+
34
+ def to_date
35
+ ::Date.new(year, month, day)
36
+ end
37
+
38
+ def to_time
39
+ ::Time.at(self.to_i)
40
+ end
41
+
42
+ def to_datetime
43
+ ::DateTime.civil(year, month, day, hour, min, sec, Rational(utc_offset, 86400))
44
+ end
45
+
46
+ def to_tc_date
47
+ ::TimeCrisis::Date.civil(year, month, day)
48
+ end
49
+
50
+ def to_tc_time
51
+ self
52
+ end
53
+
54
+ def to_tc_datetime
55
+ ::TimeCrisis::DateTime.civil(year, month, day, hour, min, sec, 0, utc_offset)
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,21 @@
1
+ if RUBY_VERSION < '1.9'
2
+ module TimeCrisis
3
+ class Time
4
+ class << self
5
+ alias_method :_original_load, :_load
6
+ def _load(marshaled_time)
7
+ time = _original_load(marshaled_time)
8
+ utc = time.instance_variable_get('@marshal_with_utc_coercion')
9
+ utc ? time.utc : time
10
+ end
11
+ end
12
+
13
+ alias_method :_original_dump, :_dump
14
+ def _dump(*args)
15
+ obj = frozen? ? dup : self
16
+ obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
17
+ obj._original_dump(*args)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ module TimeCrisis
2
+ class Time
3
+ %w(to_date to_datetime).each do |method|
4
+ if private_instance_methods.include?(method) || private_instance_methods.include?(method.to_sym)
5
+ public method
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,44 @@
1
+ require 'time_crisis/support/time_with_zone'
2
+
3
+ module TimeCrisis
4
+ class Time
5
+ class << self
6
+ attr_accessor :zone_default
7
+
8
+ def zone
9
+ Thread.current[:time_zone] || zone_default
10
+ end
11
+
12
+ def zone=(time_zone)
13
+ Thread.current[:time_zone] = get_zone(time_zone)
14
+ end
15
+
16
+ def use_zone(time_zone)
17
+ old_zone, ::TimeCrisis::Time.zone = ::TimeCrisis::Time.zone, get_zone(time_zone)
18
+ yield
19
+ ensure
20
+ ::TimeCrisis::Time.zone = old_zone
21
+ end
22
+
23
+ def current
24
+ ::TimeCrisis::Time.zone_default ? ::TimeCrisis::Time.zone.now : ::TimeCrisis::Time.now
25
+ end
26
+
27
+ private
28
+
29
+ def get_zone(time_zone)
30
+ return time_zone if time_zone.nil? || time_zone.is_a?(TimeCrisis::TimeZone)
31
+ unless time_zone.respond_to?(:period_for_local)
32
+ time_zone = TimeCrisis::TimeZone[time_zone] || TimeCrisis::TZInfo::Timezone.get(time_zone) rescue nil
33
+ end
34
+ if time_zone
35
+ time_zone.is_a?(TimeCrisis::TimeZone) ? time_zone : TimeCrisis::TimeZone.create(time_zone.name, nil, time_zone)
36
+ end
37
+ end
38
+ end
39
+
40
+ def in_time_zone(zone = ::TimeCrisis::Time.zone)
41
+ TimeCrisis::TimeWithZone.new(utc? ? self : getutc, ::TimeCrisis::Time.__send__(:get_zone, zone))
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,272 @@
1
+ require "time_crisis/support/values/time_zone"
2
+ require 'yaml'
3
+
4
+ module TimeCrisis
5
+ class TimeWithZone
6
+
7
+ def self.name
8
+ 'Time'
9
+ end
10
+
11
+ include Comparable
12
+ attr_reader :time_zone
13
+
14
+ def initialize(utc_time, time_zone, local_time = nil, period = nil)
15
+ @utc, @time_zone, @time = utc_time, time_zone, local_time
16
+ @period = @utc ? period : get_period_and_ensure_valid_local_time
17
+ end
18
+
19
+ def time
20
+ @time ||= period.to_local(@utc)
21
+ end
22
+
23
+ def utc
24
+ @utc ||= period.to_utc(@time)
25
+ end
26
+ alias_method :comparable_time, :utc
27
+ alias_method :getgm, :utc
28
+ alias_method :getutc, :utc
29
+ alias_method :gmtime, :utc
30
+
31
+ def period
32
+ @period ||= time_zone.period_for_utc(@utc)
33
+ end
34
+
35
+ def in_time_zone(new_zone = ::TimeCrisis::Time.zone)
36
+ return self if time_zone == new_zone
37
+ utc.in_time_zone(new_zone)
38
+ end
39
+
40
+ def localtime
41
+ utc.getlocal
42
+ end
43
+ alias_method :getlocal, :localtime
44
+
45
+ def dst?
46
+ period.dst?
47
+ end
48
+ alias_method :isdst, :dst?
49
+
50
+ def utc?
51
+ time_zone.name == 'UTC'
52
+ end
53
+ alias_method :gmt?, :utc?
54
+
55
+ def utc_offset
56
+ period.utc_total_offset
57
+ end
58
+ alias_method :gmt_offset, :utc_offset
59
+ alias_method :gmtoff, :utc_offset
60
+
61
+ def formatted_offset(colon = true, alternate_utc_string = nil)
62
+ utc? && alternate_utc_string || TimeZone.seconds_to_utc_offset(utc_offset, colon)
63
+ end
64
+
65
+ def zone
66
+ period.zone_identifier.to_s
67
+ end
68
+
69
+ def inspect
70
+ "#{time.strftime('%a, %d %b %Y %H:%M:%S')} #{zone} #{formatted_offset}"
71
+ end
72
+
73
+ def xmlschema(fraction_digits = 0)
74
+ fraction = if fraction_digits > 0
75
+ ".%i" % time.usec.to_s[0, fraction_digits]
76
+ end
77
+
78
+ "#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{fraction}#{formatted_offset(true, 'Z')}"
79
+ end
80
+ alias_method :iso8601, :xmlschema
81
+
82
+ def to_yaml(options = {})
83
+ if options.kind_of?(YAML::Emitter)
84
+ utc.to_yaml(options)
85
+ else
86
+ time.to_yaml(options).gsub('Z', formatted_offset(true, 'Z'))
87
+ end
88
+ end
89
+
90
+ def httpdate
91
+ utc.httpdate
92
+ end
93
+
94
+ def rfc2822
95
+ to_s(:rfc822)
96
+ end
97
+ alias_method :rfc822, :rfc2822
98
+
99
+ def to_s(format = :default)
100
+ if format == :db
101
+ utc.to_s(format)
102
+ elsif formatter = ::TimeCrisis::Time::DATE_FORMATS[format]
103
+ formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
104
+ else
105
+ "#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}"
106
+ end
107
+ end
108
+ alias_method :to_formatted_s, :to_s
109
+
110
+ def strftime(format)
111
+ format = format.gsub('%Z', zone).gsub('%z', formatted_offset(false))
112
+ time.strftime(format)
113
+ end
114
+
115
+ def <=>(other)
116
+ utc <=> other
117
+ end
118
+
119
+ def between?(min, max)
120
+ utc.between?(min, max)
121
+ end
122
+
123
+ def past?
124
+ utc.past?
125
+ end
126
+
127
+ def today?
128
+ time.today?
129
+ end
130
+
131
+ def future?
132
+ utc.future?
133
+ end
134
+
135
+ def eql?(other)
136
+ utc == other
137
+ end
138
+
139
+ def +(other)
140
+ if duration_of_variable_length?(other)
141
+ method_missing(:+, other)
142
+ else
143
+ result = utc.acts_like?(:date) ? utc.since(other) : utc + other rescue utc.since(other)
144
+ result.in_time_zone(time_zone)
145
+ end
146
+ end
147
+
148
+ def -(other)
149
+ if other.acts_like?(:time)
150
+ utc.to_f - other.to_f
151
+ elsif duration_of_variable_length?(other)
152
+ method_missing(:-, other)
153
+ else
154
+ result = utc.acts_like?(:date) ? utc.ago(other) : utc - other rescue utc.ago(other)
155
+ result.in_time_zone(time_zone)
156
+ end
157
+ end
158
+
159
+ def since(other)
160
+ if duration_of_variable_length?(other)
161
+ method_missing(:since, other)
162
+ else
163
+ utc.since(other).in_time_zone(time_zone)
164
+ end
165
+ end
166
+
167
+ def ago(other)
168
+ since(-other)
169
+ end
170
+
171
+ def advance(options)
172
+ if options.values_at(:years, :weeks, :months, :days).any?
173
+ method_missing(:advance, options)
174
+ else
175
+ utc.advance(options).in_time_zone(time_zone)
176
+ end
177
+ end
178
+
179
+ %w(year mon month day mday wday yday hour min sec to_date to_tc_date).each do |method_name|
180
+ class_eval <<-EOV, __FILE__, __LINE__ + 1
181
+ def #{method_name} # def month
182
+ time.#{method_name} # time.month
183
+ end # end
184
+ EOV
185
+ end
186
+
187
+ def usec
188
+ time.respond_to?(:usec) ? time.usec : 0
189
+ end
190
+
191
+ def to_a
192
+ [time.sec, time.min, time.hour, time.day, time.mon, time.year, time.wday, time.yday, dst?, zone]
193
+ end
194
+
195
+ def to_f
196
+ utc.to_f
197
+ end
198
+
199
+ def to_i
200
+ utc.to_i
201
+ end
202
+ alias_method :hash, :to_i
203
+ alias_method :tv_sec, :to_i
204
+
205
+ def to_time
206
+ self
207
+ end
208
+
209
+ def to_tc_time
210
+ self
211
+ end
212
+
213
+ def to_datetime
214
+ utc.to_datetime.new_offset(Rational(utc_offset, 86_400))
215
+ end
216
+
217
+ def to_tc_datetime
218
+ utc.to_tc_datetime.new_offset(utc_offset)
219
+ end
220
+
221
+ def acts_like_time?
222
+ true
223
+ end
224
+
225
+ def is_a?(klass)
226
+ klass == ::Time || klass == ::TimeCrisis::Time || super
227
+ end
228
+ alias_method :kind_of?, :is_a?
229
+
230
+ def freeze
231
+ period; utc; time
232
+ super
233
+ end
234
+
235
+ def marshal_dump
236
+ [utc, time_zone.name, time]
237
+ end
238
+
239
+ def marshal_load(variables)
240
+ initialize(variables[0].utc, ::TimeCrisis::Time.__send__(:get_zone, variables[1]), variables[2].utc)
241
+ end
242
+
243
+ def respond_to?(sym, include_priv = false)
244
+ return false if sym.to_s == 'acts_like_date?'
245
+ super || time.respond_to?(sym, include_priv)
246
+ end
247
+
248
+ def method_missing(sym, *args, &block)
249
+ result = time.__send__(sym, *args, &block)
250
+ result.acts_like?(:time) ? self.class.new(nil, time_zone, result) : result
251
+ end
252
+
253
+ private
254
+ def get_period_and_ensure_valid_local_time
255
+ @time = transfer_time_values_to_utc_constructor(@time) unless @time.utc?
256
+ begin
257
+ @time_zone.period_for_local(@time)
258
+ rescue ::TimeCrisis::TZInfo::PeriodNotFound
259
+ @time += 1.hour
260
+ retry
261
+ end
262
+ end
263
+
264
+ def transfer_time_values_to_utc_constructor(time)
265
+ ::TimeCrisis::Time.utc_time(time.year, time.month, time.day, time.hour, time.min, time.sec, time.respond_to?(:usec) ? time.usec : 0)
266
+ end
267
+
268
+ def duration_of_variable_length?(obj)
269
+ TimeCrisis::Duration === obj && obj.parts.any? {|p| [:years, :months, :days].include? p[0] }
270
+ end
271
+ end
272
+ end
@@ -0,0 +1,339 @@
1
+ require 'time_crisis/support/ext/object/blank'
2
+
3
+ module TimeCrisis
4
+ class TimeZone
5
+ unless const_defined?(:MAPPING)
6
+ # Keys are Rails TimeZone names, values are TZInfo identifiers
7
+ MAPPING = {
8
+ "International Date Line West" => "Pacific/Midway",
9
+ "Midway Island" => "Pacific/Midway",
10
+ "Samoa" => "Pacific/Pago_Pago",
11
+ "Hawaii" => "Pacific/Honolulu",
12
+ "Alaska" => "America/Juneau",
13
+ "Pacific Time (US & Canada)" => "America/Los_Angeles",
14
+ "Tijuana" => "America/Tijuana",
15
+ "Mountain Time (US & Canada)" => "America/Denver",
16
+ "Arizona" => "America/Phoenix",
17
+ "Chihuahua" => "America/Chihuahua",
18
+ "Mazatlan" => "America/Mazatlan",
19
+ "Central Time (US & Canada)" => "America/Chicago",
20
+ "Saskatchewan" => "America/Regina",
21
+ "Guadalajara" => "America/Mexico_City",
22
+ "Mexico City" => "America/Mexico_City",
23
+ "Monterrey" => "America/Monterrey",
24
+ "Central America" => "America/Guatemala",
25
+ "Eastern Time (US & Canada)" => "America/New_York",
26
+ "Indiana (East)" => "America/Indiana/Indianapolis",
27
+ "Bogota" => "America/Bogota",
28
+ "Lima" => "America/Lima",
29
+ "Quito" => "America/Lima",
30
+ "Atlantic Time (Canada)" => "America/Halifax",
31
+ "Caracas" => "America/Caracas",
32
+ "La Paz" => "America/La_Paz",
33
+ "Santiago" => "America/Santiago",
34
+ "Newfoundland" => "America/St_Johns",
35
+ "Brasilia" => "America/Sao_Paulo",
36
+ "Buenos Aires" => "America/Argentina/Buenos_Aires",
37
+ "Georgetown" => "America/Argentina/San_Juan",
38
+ "Greenland" => "America/Godthab",
39
+ "Mid-Atlantic" => "Atlantic/South_Georgia",
40
+ "Azores" => "Atlantic/Azores",
41
+ "Cape Verde Is." => "Atlantic/Cape_Verde",
42
+ "Dublin" => "Europe/Dublin",
43
+ "Edinburgh" => "Europe/London",
44
+ "Lisbon" => "Europe/Lisbon",
45
+ "London" => "Europe/London",
46
+ "Casablanca" => "Africa/Casablanca",
47
+ "Monrovia" => "Africa/Monrovia",
48
+ "UTC" => "Etc/UTC",
49
+ "Belgrade" => "Europe/Belgrade",
50
+ "Bratislava" => "Europe/Bratislava",
51
+ "Budapest" => "Europe/Budapest",
52
+ "Ljubljana" => "Europe/Ljubljana",
53
+ "Prague" => "Europe/Prague",
54
+ "Sarajevo" => "Europe/Sarajevo",
55
+ "Skopje" => "Europe/Skopje",
56
+ "Warsaw" => "Europe/Warsaw",
57
+ "Zagreb" => "Europe/Zagreb",
58
+ "Brussels" => "Europe/Brussels",
59
+ "Copenhagen" => "Europe/Copenhagen",
60
+ "Madrid" => "Europe/Madrid",
61
+ "Paris" => "Europe/Paris",
62
+ "Amsterdam" => "Europe/Amsterdam",
63
+ "Berlin" => "Europe/Berlin",
64
+ "Bern" => "Europe/Berlin",
65
+ "Rome" => "Europe/Rome",
66
+ "Stockholm" => "Europe/Stockholm",
67
+ "Vienna" => "Europe/Vienna",
68
+ "West Central Africa" => "Africa/Algiers",
69
+ "Bucharest" => "Europe/Bucharest",
70
+ "Cairo" => "Africa/Cairo",
71
+ "Helsinki" => "Europe/Helsinki",
72
+ "Kyiv" => "Europe/Kiev",
73
+ "Riga" => "Europe/Riga",
74
+ "Sofia" => "Europe/Sofia",
75
+ "Tallinn" => "Europe/Tallinn",
76
+ "Vilnius" => "Europe/Vilnius",
77
+ "Athens" => "Europe/Athens",
78
+ "Istanbul" => "Europe/Istanbul",
79
+ "Minsk" => "Europe/Minsk",
80
+ "Jerusalem" => "Asia/Jerusalem",
81
+ "Harare" => "Africa/Harare",
82
+ "Pretoria" => "Africa/Johannesburg",
83
+ "Moscow" => "Europe/Moscow",
84
+ "St. Petersburg" => "Europe/Moscow",
85
+ "Volgograd" => "Europe/Moscow",
86
+ "Kuwait" => "Asia/Kuwait",
87
+ "Riyadh" => "Asia/Riyadh",
88
+ "Nairobi" => "Africa/Nairobi",
89
+ "Baghdad" => "Asia/Baghdad",
90
+ "Tehran" => "Asia/Tehran",
91
+ "Abu Dhabi" => "Asia/Muscat",
92
+ "Muscat" => "Asia/Muscat",
93
+ "Baku" => "Asia/Baku",
94
+ "Tbilisi" => "Asia/Tbilisi",
95
+ "Yerevan" => "Asia/Yerevan",
96
+ "Kabul" => "Asia/Kabul",
97
+ "Ekaterinburg" => "Asia/Yekaterinburg",
98
+ "Islamabad" => "Asia/Karachi",
99
+ "Karachi" => "Asia/Karachi",
100
+ "Tashkent" => "Asia/Tashkent",
101
+ "Chennai" => "Asia/Kolkata",
102
+ "Kolkata" => "Asia/Kolkata",
103
+ "Mumbai" => "Asia/Kolkata",
104
+ "New Delhi" => "Asia/Kolkata",
105
+ "Kathmandu" => "Asia/Kathmandu",
106
+ "Astana" => "Asia/Dhaka",
107
+ "Dhaka" => "Asia/Dhaka",
108
+ "Sri Jayawardenepura" => "Asia/Colombo",
109
+ "Almaty" => "Asia/Almaty",
110
+ "Novosibirsk" => "Asia/Novosibirsk",
111
+ "Rangoon" => "Asia/Rangoon",
112
+ "Bangkok" => "Asia/Bangkok",
113
+ "Hanoi" => "Asia/Bangkok",
114
+ "Jakarta" => "Asia/Jakarta",
115
+ "Krasnoyarsk" => "Asia/Krasnoyarsk",
116
+ "Beijing" => "Asia/Shanghai",
117
+ "Chongqing" => "Asia/Chongqing",
118
+ "Hong Kong" => "Asia/Hong_Kong",
119
+ "Urumqi" => "Asia/Urumqi",
120
+ "Kuala Lumpur" => "Asia/Kuala_Lumpur",
121
+ "Singapore" => "Asia/Singapore",
122
+ "Taipei" => "Asia/Taipei",
123
+ "Perth" => "Australia/Perth",
124
+ "Irkutsk" => "Asia/Irkutsk",
125
+ "Ulaan Bataar" => "Asia/Ulaanbaatar",
126
+ "Seoul" => "Asia/Seoul",
127
+ "Osaka" => "Asia/Tokyo",
128
+ "Sapporo" => "Asia/Tokyo",
129
+ "Tokyo" => "Asia/Tokyo",
130
+ "Yakutsk" => "Asia/Yakutsk",
131
+ "Darwin" => "Australia/Darwin",
132
+ "Adelaide" => "Australia/Adelaide",
133
+ "Canberra" => "Australia/Melbourne",
134
+ "Melbourne" => "Australia/Melbourne",
135
+ "Sydney" => "Australia/Sydney",
136
+ "Brisbane" => "Australia/Brisbane",
137
+ "Hobart" => "Australia/Hobart",
138
+ "Vladivostok" => "Asia/Vladivostok",
139
+ "Guam" => "Pacific/Guam",
140
+ "Port Moresby" => "Pacific/Port_Moresby",
141
+ "Magadan" => "Asia/Magadan",
142
+ "Solomon Is." => "Asia/Magadan",
143
+ "New Caledonia" => "Pacific/Noumea",
144
+ "Fiji" => "Pacific/Fiji",
145
+ "Kamchatka" => "Asia/Kamchatka",
146
+ "Marshall Is." => "Pacific/Majuro",
147
+ "Auckland" => "Pacific/Auckland",
148
+ "Wellington" => "Pacific/Auckland",
149
+ "Nuku'alofa" => "Pacific/Tongatapu"
150
+ }.each { |name, zone| name.freeze; zone.freeze }
151
+ MAPPING.freeze
152
+ end
153
+
154
+ UTC_OFFSET_WITH_COLON = '%+03d:%02d'
155
+ UTC_OFFSET_WITHOUT_COLON = UTC_OFFSET_WITH_COLON.sub(':', '')
156
+
157
+ def self.seconds_to_utc_offset(seconds, colon = true)
158
+ format = colon ? UTC_OFFSET_WITH_COLON : UTC_OFFSET_WITHOUT_COLON
159
+ hours = seconds / 3600
160
+ minutes = (seconds.abs % 3600) / 60
161
+ format % [hours, minutes]
162
+ end
163
+
164
+ include Comparable
165
+ attr_reader :name
166
+
167
+ def initialize(name, utc_offset, tzinfo = nil)
168
+ @name = name
169
+ @utc_offset = utc_offset
170
+ @tzinfo = tzinfo
171
+ end
172
+
173
+ def utc_offset
174
+ @utc_offset ||= tzinfo.current_period.utc_offset
175
+ end
176
+
177
+ def formatted_offset(colon=true, alternate_utc_string = nil)
178
+ utc_offset == 0 && alternate_utc_string || self.class.seconds_to_utc_offset(utc_offset, colon)
179
+ end
180
+
181
+ def <=>(zone)
182
+ result = (utc_offset <=> zone.utc_offset)
183
+ result = (name <=> zone.name) if result == 0
184
+ result
185
+ end
186
+
187
+ def =~(re)
188
+ return true if name =~ re || MAPPING[name] =~ re
189
+ end
190
+
191
+ def to_s
192
+ "(GMT#{formatted_offset}) #{name}"
193
+ end
194
+
195
+ def local(*args)
196
+ time = TimeCrisis::Time.utc_time(*args)
197
+ TimeCrisis::TimeWithZone.new(nil, self, time)
198
+ end
199
+
200
+ def at(secs)
201
+ utc = TimeCrisis::Time.at(secs).utc rescue DateTime.civil(1970).since(secs)
202
+ utc.in_time_zone(self)
203
+ end
204
+
205
+ def parse(str, now=now)
206
+ date_parts = TimeCrisis::Date._parse(str)
207
+ return if date_parts.blank?
208
+ time = TimeCrisis::Time.parse(str, now) rescue TimeCrisis::DateTime.parse(str)
209
+ if date_parts[:offset].nil?
210
+ TimeCrisis::TimeWithZone.new(nil, self, time)
211
+ else
212
+ time.in_time_zone(self)
213
+ end
214
+ end
215
+
216
+ def now
217
+ TimeCrisis::Time.now.utc.in_time_zone(self)
218
+ end
219
+
220
+ def today
221
+ tzinfo.now.to_tc_date
222
+ end
223
+
224
+ def utc_to_local(time)
225
+ tzinfo.utc_to_local(time)
226
+ end
227
+
228
+ def local_to_utc(time, dst=true)
229
+ tzinfo.local_to_utc(time, dst)
230
+ end
231
+
232
+ def period_for_utc(time)
233
+ tzinfo.period_for_utc(time)
234
+ end
235
+
236
+ def period_for_local(time, dst=true)
237
+ tzinfo.period_for_local(time, dst)
238
+ end
239
+
240
+ def tzinfo
241
+ @tzinfo ||= ::TimeCrisis::TZInfo::Timezone.get(MAPPING[name])
242
+ end
243
+
244
+ unless const_defined?(:ZONES)
245
+ ZONES = []
246
+ ZONES_MAP = {}
247
+ [[-39_600, "International Date Line West", "Midway Island", "Samoa" ],
248
+ [-36_000, "Hawaii" ],
249
+ [-32_400, "Alaska" ],
250
+ [-28_800, "Pacific Time (US & Canada)", "Tijuana" ],
251
+ [-25_200, "Mountain Time (US & Canada)", "Chihuahua", "Mazatlan",
252
+ "Arizona" ],
253
+ [-21_600, "Central Time (US & Canada)", "Saskatchewan", "Guadalajara",
254
+ "Mexico City", "Monterrey", "Central America" ],
255
+ [-18_000, "Eastern Time (US & Canada)", "Indiana (East)", "Bogota",
256
+ "Lima", "Quito" ],
257
+ [-16_200, "Caracas" ],
258
+ [-14_400, "Atlantic Time (Canada)", "La Paz", "Santiago" ],
259
+ [-12_600, "Newfoundland" ],
260
+ [-10_800, "Brasilia", "Buenos Aires", "Georgetown", "Greenland" ],
261
+ [ -7_200, "Mid-Atlantic" ],
262
+ [ -3_600, "Azores", "Cape Verde Is." ],
263
+ [ 0, "Dublin", "Edinburgh", "Lisbon", "London", "Casablanca",
264
+ "Monrovia", "UTC" ],
265
+ [ 3_600, "Belgrade", "Bratislava", "Budapest", "Ljubljana", "Prague",
266
+ "Sarajevo", "Skopje", "Warsaw", "Zagreb", "Brussels",
267
+ "Copenhagen", "Madrid", "Paris", "Amsterdam", "Berlin",
268
+ "Bern", "Rome", "Stockholm", "Vienna",
269
+ "West Central Africa" ],
270
+ [ 7_200, "Bucharest", "Cairo", "Helsinki", "Kyiv", "Riga", "Sofia",
271
+ "Tallinn", "Vilnius", "Athens", "Istanbul", "Minsk",
272
+ "Jerusalem", "Harare", "Pretoria" ],
273
+ [ 10_800, "Moscow", "St. Petersburg", "Volgograd", "Kuwait", "Riyadh",
274
+ "Nairobi", "Baghdad" ],
275
+ [ 12_600, "Tehran" ],
276
+ [ 14_400, "Abu Dhabi", "Muscat", "Baku", "Tbilisi", "Yerevan" ],
277
+ [ 16_200, "Kabul" ],
278
+ [ 18_000, "Ekaterinburg", "Islamabad", "Karachi", "Tashkent" ],
279
+ [ 19_800, "Chennai", "Kolkata", "Mumbai", "New Delhi", "Sri Jayawardenepura" ],
280
+ [ 20_700, "Kathmandu" ],
281
+ [ 21_600, "Astana", "Dhaka", "Almaty",
282
+ "Novosibirsk" ],
283
+ [ 23_400, "Rangoon" ],
284
+ [ 25_200, "Bangkok", "Hanoi", "Jakarta", "Krasnoyarsk" ],
285
+ [ 28_800, "Beijing", "Chongqing", "Hong Kong", "Urumqi",
286
+ "Kuala Lumpur", "Singapore", "Taipei", "Perth", "Irkutsk",
287
+ "Ulaan Bataar" ],
288
+ [ 32_400, "Seoul", "Osaka", "Sapporo", "Tokyo", "Yakutsk" ],
289
+ [ 34_200, "Darwin", "Adelaide" ],
290
+ [ 36_000, "Canberra", "Melbourne", "Sydney", "Brisbane", "Hobart",
291
+ "Vladivostok", "Guam", "Port Moresby" ],
292
+ [ 39_600, "Magadan", "Solomon Is.", "New Caledonia" ],
293
+ [ 43_200, "Fiji", "Kamchatka", "Marshall Is.", "Auckland",
294
+ "Wellington" ],
295
+ [ 46_800, "Nuku'alofa" ]].
296
+ each do |offset, *places|
297
+ places.sort.each do |place|
298
+ place.freeze
299
+ zone = new(place, offset)
300
+ ZONES << zone
301
+ ZONES_MAP[place] = zone
302
+ end
303
+ end
304
+ ZONES.freeze
305
+ ZONES_MAP.freeze
306
+
307
+ US_ZONES = ZONES.find_all { |z| z.name =~ /US|Arizona|Indiana|Hawaii|Alaska/ }
308
+ US_ZONES.freeze
309
+ end
310
+
311
+ class << self
312
+ alias_method :create, :new
313
+
314
+ def new(name)
315
+ self[name]
316
+ end
317
+
318
+ def all
319
+ ZONES
320
+ end
321
+
322
+ def [](arg)
323
+ case arg
324
+ when String
325
+ ZONES_MAP[arg]
326
+ when Numeric, TimeCrisis::Duration
327
+ arg *= 3600 if arg.abs <= 13
328
+ all.find { |z| z.utc_offset == arg.to_i }
329
+ else
330
+ raise ArgumentError, "invalid argument to TimeZone[]: #{arg.inspect}"
331
+ end
332
+ end
333
+
334
+ def us_zones
335
+ US_ZONES
336
+ end
337
+ end
338
+ end
339
+ end