diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/http/luasrc/http/protocol/date.lua | 112 | ||||
-rw-r--r-- | libs/sys/luasrc/sys/zoneinfo.lua | 196 |
2 files changed, 185 insertions, 123 deletions
diff --git a/libs/http/luasrc/http/protocol/date.lua b/libs/http/luasrc/http/protocol/date.lua index 24da1bafbb..83d11e2c25 100644 --- a/libs/http/luasrc/http/protocol/date.lua +++ b/libs/http/luasrc/http/protocol/date.lua @@ -17,116 +17,14 @@ $Id$ -- This class contains functions to parse, compare and format http dates. module("luci.http.protocol.date", package.seeall) +require("luci.sys.zoneinfo") + + MONTHS = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } ---- The "TZ" table contains lowercased timezone names associated with their --- corresponding time offsets sepcified in seconds. --- @class table -TZ = { - -- DST zones - ["brst"] = -2*3600; -- Brazil Summer Time (East Daylight) - ["adt"] = -3*3600; -- Atlantic Daylight - ["edt"] = -4*3600; -- Eastern Daylight - ["cdt"] = -5*3600; -- Central Daylight - ["mdt"] = -6*3600; -- Mountain Daylight - ["pdt"] = -7*3600; -- Pacific Daylight - ["ydt"] = -8*3600; -- Yukon Daylight - ["hdt"] = -9*3600; -- Hawaii Daylight - ["bst"] = 1*3600; -- British Summer - ["mest"] = 2*3600; -- Middle European Summer - ["sst"] = 2*3600; -- Swedish Summer - ["fst"] = 2*3600; -- French Summer - ["eest"] = 3*3600; -- Eastern European Summer - ["cest"] = 2*3600; -- Central European Daylight - ["wadt"] = 8*3600; -- West Australian Daylight - ["kdt"] = 10*3600; -- Korean Daylight - ["eadt"] = 11*3600; -- Eastern Australian Daylight - ["nzdt"] = 13*3600; -- New Zealand Daylight - - -- zones - ["gmt"] = 0; -- Greenwich Mean - ["ut"] = 0; -- Universal (Coordinated) - ["utc"] = 0; - ["wet"] = 0; -- Western European - ["wat"] = -1*3600; -- West Africa - ["azost"] = -1*3600; -- Azores Standard Time - ["cvt"] = -1*3600; -- Cape Verde Time - ["at"] = -2*3600; -- Azores - ["fnt"] = -2*3600; -- Brazil Time (Extreme East - Fernando Noronha) - ["ndt"] = -2*3600+1800;-- Newfoundland Daylight - ["art"] = -3*3600; -- Argentina Time - ["nft"] = -3*3600+1800;-- Newfoundland - ["mnt"] = -4*3600; -- Brazil Time (West Standard - Manaus) - ["ewt"] = -4*3600; -- U.S. Eastern War Time - ["ast"] = -4*3600; -- Atlantic Standard - ["bot"] = -4*3600; -- Bolivia Time - ["vet"] = -4*3600; -- Venezuela Time - ["est"] = -5*3600; -- Eastern Standard - ["cot"] = -5*3600; -- Colombia Time - ["act"] = -5*3600; -- Brazil Time (Extreme West - Acre) - ["pet"] = -5*3600; -- Peru Time - ["cst"] = -6*3600; -- Central Standard - ["cest"] = 2*3600; -- Central European Summer - ["mst"] = -7*3600; -- Mountain Standard - ["pst"] = -8*3600; -- Pacific Standard - ["yst"] = -9*3600; -- Yukon Standard - ["hst"] = -10*3600; -- Hawaii Standard - ["cat"] = -10*3600; -- Central Alaska - ["ahst"] = -10*3600; -- Alaska-Hawaii Standard - ["taht"] = -10*3600; -- Tahiti Time - ["nt"] = -11*3600; -- Nome - ["idlw"] = -12*3600; -- International Date Line West - ["cet"] = 1*3600; -- Central European - ["mez"] = 1*3600; -- Central European (German) - ["met"] = 1*3600; -- Middle European - ["mewt"] = 1*3600; -- Middle European Winter - ["swt"] = 1*3600; -- Swedish Winter - ["set"] = 1*3600; -- Seychelles - ["fwt"] = 1*3600; -- French Winter - ["west"] = 1*3600; -- Western Europe Summer Time - ["eet"] = 2*3600; -- Eastern Europe; USSR Zone 1 - ["ukr"] = 2*3600; -- Ukraine - ["sast"] = 2*3600; -- South Africa Standard Time - ["bt"] = 3*3600; -- Baghdad; USSR Zone 2 - ["eat"] = 3*3600; -- East Africa Time - ["irst"] = 3*3600+1800;-- Iran Standard Time - ["zp4"] = 4*3600; -- USSR Zone 3 - ["msd"] = 4*3600; -- Moscow Daylight Time - ["sct"] = 4*3600; -- Seychelles Time - ["zp5"] = 5*3600; -- USSR Zone 4 - ["azst"] = 5*3600; -- Azerbaijan Summer Time - ["mvt"] = 5*3600; -- Maldives Time - ["uzt"] = 5*3600; -- Uzbekistan Time - ["ist"] = 5*3600+1800;-- Indian Standard - ["zp6"] = 6*3600; -- USSR Zone 5 - ["lkt"] = 6*3600; -- Sri Lanka Time - ["pkst"] = 6*3600; -- Pakistan Summer Time - ["yekst"] = 6*3600; -- Yekaterinburg Summer Time - ["wast"] = 7*3600; -- West Australian Standard - ["ict"] = 7*3600; -- Indochina Time - ["wit"] = 7*3600; -- Western Indonesia Time - ["cct"] = 8*3600; -- China Coast; USSR Zone 7 - ["wst"] = 8*3600; -- West Australian Standard - ["hkt"] = 8*3600; -- Hong Kong - ["bnt"] = 8*3600; -- Brunei Darussalam Time - ["cit"] = 8*3600; -- Central Indonesia Time - ["myt"] = 8*3600; -- Malaysia Time - ["pht"] = 8*3600; -- Philippines Time - ["sgt"] = 8*3600; -- Singapore Time - ["jst"] = 9*3600; -- Japan Standard; USSR Zone 8 - ["kst"] = 9*3600; -- Korean Standard - ["east"] = 10*3600; -- Eastern Australian Standard - ["gst"] = 10*3600; -- Guam Standard; USSR Zone 9 - ["nct"] = 11*3600; -- New Caledonia Time - ["nzt"] = 12*3600; -- New Zealand - ["nzst"] = 12*3600; -- New Zealand Standard - ["fjt"] = 12*3600; -- Fiji Time - ["idle"] = 12*3600; -- International Date Line East -} - --- Return the time offset in seconds between the UTC and given time zone. -- @param tz Symbolic or numeric timezone specifier -- @return Time offset to UTC in seconds @@ -143,8 +41,8 @@ function tz_offset(tz) return s * 60 * ( math.floor( v / 100 ) * 60 + ( v % 100 ) ) -- lookup symbolic tz - elseif TZ[tz:lower()] then - return TZ[tz:lower()] + elseif luci.sys.zoneinfo.OFFSET[tz:lower()] then + return luci.sys.zoneinfo.OFFSET[tz:lower()] end end diff --git a/libs/sys/luasrc/sys/zoneinfo.lua b/libs/sys/luasrc/sys/zoneinfo.lua index 7bd02d9347..d6de704257 100644 --- a/libs/sys/luasrc/sys/zoneinfo.lua +++ b/libs/sys/luasrc/sys/zoneinfo.lua @@ -67,17 +67,18 @@ TZ = { { 'America/Anguilla', 'AST4' }, { 'America/Antigua', 'AST4' }, { 'America/Araguaina', 'BRT3' }, - { 'America/Argentina/Buenos Aires', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Catamarca', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Cordoba', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Jujuy', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/La Rioja', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Mendoza', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Rio Gallegos', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/San Juan', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, + { 'America/Argentina/Buenos Aires', 'ART3ARST,M10.3.0/0,M3.3.0/0' }, + { 'America/Argentina/Catamarca', 'ART3' }, + { 'America/Argentina/Cordoba', 'ART3ARST,M10.3.0/0,M3.3.0/0' }, + { 'America/Argentina/Jujuy', 'ART3' }, + { 'America/Argentina/La Rioja', 'ART3' }, + { 'America/Argentina/Mendoza', 'ART3' }, + { 'America/Argentina/Rio Gallegos', 'ART3' }, + { 'America/Argentina/Salta', 'ART3' }, + { 'America/Argentina/San Juan', 'ART3' }, { 'America/Argentina/San Luis', 'ART3' }, - { 'America/Argentina/Tucuman', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, - { 'America/Argentina/Ushuaia', 'ART3ARST,M10.1.0/0,M3.3.0/0' }, + { 'America/Argentina/Tucuman', 'ART3ARST,M10.3.0/0,M3.3.0/0' }, + { 'America/Argentina/Ushuaia', 'ART3' }, { 'America/Aruba', 'AST4' }, { 'America/Asuncion', 'PYT4PYST,M10.3.0/0,M3.2.0/0' }, { 'America/Atikokan', 'EST5' }, @@ -90,7 +91,7 @@ TZ = { { 'America/Bogota', 'COT5' }, { 'America/Boise', 'MST7MDT,M3.2.0,M11.1.0' }, { 'America/Cambridge Bay', 'MST7MDT,M3.2.0,M11.1.0' }, - { 'America/Campo Grande', 'AMT4AMST,M10.2.0/0,M2.3.0/0' }, + { 'America/Campo Grande', 'AMT4AMST,M10.3.0/0,M2.3.0/0' }, { 'America/Cancun', 'CST6CDT,M4.1.0,M10.5.0' }, { 'America/Caracas', 'VET4:30' }, { 'America/Cayenne', 'GFT3' }, @@ -98,7 +99,7 @@ TZ = { { 'America/Chicago', 'CST6CDT,M3.2.0,M11.1.0' }, { 'America/Chihuahua', 'MST7MDT,M4.1.0,M10.5.0' }, { 'America/Costa Rica', 'CST6' }, - { 'America/Cuiaba', 'AMT4AMST,M10.2.0/0,M2.3.0/0' }, + { 'America/Cuiaba', 'AMT4AMST,M10.3.0/0,M2.3.0/0' }, { 'America/Curacao', 'AST4' }, { 'America/Danmarkshavn', 'GMT0' }, { 'America/Dawson', 'PST8PDT,M3.2.0,M11.1.0' }, @@ -176,7 +177,7 @@ TZ = { { 'America/Rio Branco', 'AMT4' }, { 'America/Santarem', 'BRT3' }, { 'America/Santo Domingo', 'AST4' }, - { 'America/Sao Paulo', 'BRT3BRST,M10.2.0/0,M2.3.0/0' }, + { 'America/Sao Paulo', 'BRT3BRST,M10.3.0/0,M2.3.0/0' }, { 'America/Scoresbysund', 'EGT1EGST,M3.5.0/0,M10.5.0/1' }, { 'America/Shiprock', 'MST7MDT,M3.2.0,M11.1.0' }, { 'America/St Barthelemy', 'AST4' }, @@ -224,12 +225,12 @@ TZ = { { 'Asia/Choibalsan', 'CHOT-8' }, { 'Asia/Chongqing', 'CST-8' }, { 'Asia/Colombo', 'IST-5:30' }, - { 'Asia/Damascus', 'EET-2EEST,M4.1.5/0,J274/0' }, + { 'Asia/Damascus', 'EET-2EEST,M4.1.5/0,J305/0' }, { 'Asia/Dhaka', 'BDT-6' }, { 'Asia/Dili', 'TLT-9' }, { 'Asia/Dubai', 'GST-4' }, { 'Asia/Dushanbe', 'TJT-5' }, - { 'Asia/Gaza', 'EET-2EEST,J91/0,M9.2.4' }, + { 'Asia/Gaza', 'EET-2EEST,J91/0,M8.5.4' }, { 'Asia/Harbin', 'CST-8' }, { 'Asia/Ho Chi Minh', 'ICT-7' }, { 'Asia/Hong Kong', 'HKT-8' }, @@ -365,7 +366,7 @@ TZ = { { 'Indian/Kerguelen', 'TFT-5' }, { 'Indian/Mahe', 'SCT-4' }, { 'Indian/Maldives', 'MVT-5' }, - { 'Indian/Mauritius', 'MUT-4' }, + { 'Indian/Mauritius', 'MUT-4MUST,M10.5.0,M3.5.0/3' }, { 'Indian/Mayotte', 'EAT-3' }, { 'Indian/Reunion', 'RET-4' }, { 'Pacific/Apia', 'WST11' }, @@ -406,3 +407,166 @@ TZ = { { 'Pacific/Wake', 'WAKT-12' }, { 'Pacific/Wallis', 'WFT-12' }, } + +OFFSET = { + gmt = 0, -- GMT + eat = 10800, -- EAT + cet = 3600, -- CET + wat = 3600, -- WAT + cat = 7200, -- CAT + wet = 0, -- WET + sast = 7200, -- SAST + eet = 7200, -- EET + hast = -36000, -- HAST + hadt = -32400, -- HADT + akst = -32400, -- AKST + akdt = -28800, -- AKDT + ast = -14400, -- AST + brt = -10800, -- BRT + art = -10800, -- ART + arst = -7200, -- ARST + pyt = -14400, -- PYT + pyst = -10800, -- PYST + est = -18000, -- EST + cst = -21600, -- CST + amt = -14400, -- AMT + cot = -18000, -- COT + mst = -25200, -- MST + mdt = -21600, -- MDT + vet = -16200, -- VET + gft = -10800, -- GFT + pst = -28800, -- PST + pdt = -25200, -- PDT + ect = -18000, -- ECT + gyt = -14400, -- GYT + bot = -14400, -- BOT + pet = -18000, -- PET + pmst = -10800, -- PMST + pmdt = -7200, -- PMDT + uyt = -10800, -- UYT + uyst = -7200, -- UYST + fnt = -7200, -- FNT + srt = -10800, -- SRT + egt = -3600, -- EGT + egst = 0, -- EGST + nst = -12600, -- NST + ndt = -9000, -- NDT + wst = 28800, -- WST + davt = 25200, -- DAVT + ddut = 36000, -- DDUT + mawt = 21600, -- MAWT + nzst = 43200, -- NZST + nzdt = 46800, -- NZDT + rott = -10800, -- ROTT + syot = 10800, -- SYOT + vost = 21600, -- VOST + almt = 21600, -- ALMT + anat = 43200, -- ANAT + anast = 46800, -- ANAST + aqtt = 18000, -- AQTT + tmt = 18000, -- TMT + azt = 14400, -- AZT + azst = 18000, -- AZST + ict = 25200, -- ICT + kgt = 21600, -- KGT + bnt = 28800, -- BNT + chot = 28800, -- CHOT + ist = 19800, -- IST + bdt = 21600, -- BDT + tlt = 32400, -- TLT + gst = 14400, -- GST + tjt = 18000, -- TJT + hkt = 28800, -- HKT + hovt = 25200, -- HOVT + irkt = 28800, -- IRKT + irkst = 32400, -- IRKST + wit = 25200, -- WIT + eit = 32400, -- EIT + aft = 16200, -- AFT + pett = 43200, -- PETT + petst = 46800, -- PETST + pkt = 18000, -- PKT + npt = 20700, -- NPT + krat = 25200, -- KRAT + krast = 28800, -- KRAST + myt = 28800, -- MYT + magt = 39600, -- MAGT + magst = 43200, -- MAGST + cit = 28800, -- CIT + pht = 28800, -- PHT + novt = 21600, -- NOVT + novst = 25200, -- NOVST + omst = 21600, -- OMST + omsst = 25200, -- OMSST + orat = 18000, -- ORAT + kst = 32400, -- KST + qyzt = 21600, -- QYZT + mmt = 23400, -- MMT + sakt = 36000, -- SAKT + sakst = 39600, -- SAKST + uzt = 18000, -- UZT + sgt = 28800, -- SGT + get = 14400, -- GET + btt = 21600, -- BTT + jst = 32400, -- JST + ulat = 28800, -- ULAT + vlat = 36000, -- VLAT + vlast = 39600, -- VLAST + yakt = 32400, -- YAKT + yakst = 36000, -- YAKST + yekt = 18000, -- YEKT + yekst = 21600, -- YEKST + azot = -3600, -- AZOT + azost = 0, -- AZOST + cvt = -3600, -- CVT + fkt = -14400, -- FKT + fkst = -10800, -- FKST + cwst = 31500, -- CWST + lhst = 37800, -- LHST + lhst = 39600, -- LHST + msk = 10800, -- MSK + msd = 14400, -- MSD + samt = 14400, -- SAMT + samst = 18000, -- SAMST + volt = 10800, -- VOLT + volst = 14400, -- VOLST + iot = 21600, -- IOT + cxt = 25200, -- CXT + cct = 23400, -- CCT + tft = 18000, -- TFT + sct = 14400, -- SCT + mvt = 18000, -- MVT + mut = 14400, -- MUT + must = 18000, -- MUST + ret = 14400, -- RET + chast = 45900, -- CHAST + chadt = 49500, -- CHADT + vut = 39600, -- VUT + phot = 46800, -- PHOT + tkt = -36000, -- TKT + fjt = 43200, -- FJT + tvt = 43200, -- TVT + galt = -21600, -- GALT + gamt = -32400, -- GAMT + sbt = 39600, -- SBT + hst = -36000, -- HST + lint = 50400, -- LINT + kost = 39600, -- KOST + mht = 43200, -- MHT + mart = -34200, -- MART + sst = -39600, -- SST + nrt = 43200, -- NRT + nut = -39600, -- NUT + nft = 41400, -- NFT + nct = 39600, -- NCT + pwt = 32400, -- PWT + pont = 39600, -- PONT + pgt = 36000, -- PGT + ckt = -36000, -- CKT + taht = -36000, -- TAHT + gilt = 43200, -- GILT + tot = 46800, -- TOT + trut = 36000, -- TRUT + wakt = 43200, -- WAKT + wft = 43200, -- WFT +} |