X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/e5c87b4489b0881b7b9903733478f0d11ac96ab7..e8263f466bf4da10b9577ac6029b3c2f5e1750fb:/luatz/tzcache.lua?ds=sidebyside diff --git a/luatz/tzcache.lua b/luatz/tzcache.lua index de62d79..98ced26 100644 --- a/luatz/tzcache.lua +++ b/luatz/tzcache.lua @@ -1,12 +1,16 @@ local read_tzfile = require "luatz.tzfile".read_tzfile +local base_zoneinfo_path = "/usr/share/zoneinfo/" +local local_zoneinfo_path = "/etc/localtime" local tz_cache = { } local function name_to_zoneinfo_path ( name ) - if name then - return "/usr/share/zoneinfo/" .. name + if name == nil then + return local_zoneinfo_path + elseif name:sub ( 1 , 1 ) == "/" then + return name else - return "/etc/localtime" + return base_zoneinfo_path .. name end end