summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/sys/zoneinfo.lua
blob: aa054a246f3b6a067116b48f2b3329e28226151e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
})