zoneinfo.lua 500 B

12345678910111213141516171819
  1. -- Licensed to the public under the Apache License 2.0.
  2. local setmetatable, require, rawget, rawset = setmetatable, require, rawget, rawset
  3. module "luci.sys.zoneinfo"
  4. setmetatable(_M, {
  5. __index = function(t, k)
  6. if k == "TZ" and not rawget(t, k) then
  7. local m = require "luci.sys.zoneinfo.tzdata"
  8. rawset(t, k, rawget(m, k))
  9. elseif k == "OFFSET" and not rawget(t, k) then
  10. local m = require "luci.sys.zoneinfo.tzoffset"
  11. rawset(t, k, rawget(m, k))
  12. end
  13. return rawget(t, k)
  14. end
  15. })