diff options
Diffstat (limited to 'modules/luci-lua-runtime/luasrc/sys/zoneinfo.lua')
-rw-r--r-- | modules/luci-lua-runtime/luasrc/sys/zoneinfo.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/luci-lua-runtime/luasrc/sys/zoneinfo.lua b/modules/luci-lua-runtime/luasrc/sys/zoneinfo.lua new file mode 100644 index 0000000000..aa054a246f --- /dev/null +++ b/modules/luci-lua-runtime/luasrc/sys/zoneinfo.lua @@ -0,0 +1,19 @@ +-- Licensed to the public under the Apache License 2.0. + +local setmetatable, require, rawget, rawset = setmetatable, require, rawget, rawset + +module "luci.sys.zoneinfo" + +setmetatable(_M, { + __index = function(t, k) + if k == "TZ" and not rawget(t, k) then + local m = require "luci.sys.zoneinfo.tzdata" + rawset(t, k, rawget(m, k)) + elseif k == "OFFSET" and not rawget(t, k) then + local m = require "luci.sys.zoneinfo.tzoffset" + rawset(t, k, rawget(m, k)) + end + + return rawget(t, k) + end +}) |