Merge pull request #361 from hnyman/timezone2015c
[project/luci.git] / modules / luci-base / luasrc / sys / zoneinfo.lua
1 -- Licensed to the public under the Apache License 2.0.
2
3 local setmetatable, require, rawget, rawset = setmetatable, require, rawget, rawset
4
5 module "luci.sys.zoneinfo"
6
7 setmetatable(_M, {
8         __index = function(t, k)
9                 if k == "TZ" and not rawget(t, k) then
10                         local m = require "luci.sys.zoneinfo.tzdata"
11                         rawset(t, k, rawget(m, k))
12                 elseif k == "OFFSET" and not rawget(t, k) then
13                         local m = require "luci.sys.zoneinfo.tzoffset"
14                         rawset(t, k, rawget(m, k))
15                 end
16
17                 return rawget(t, k)
18         end
19 })