]> git.madduck.net Git - etc/awesome.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

luatz/tzcache: Allow absolute paths
authordaurnimator <quae@daurnimator.com>
Mon, 18 Aug 2014 15:56:44 +0000 (11:56 -0400)
committerdaurnimator <quae@daurnimator.com>
Mon, 18 Aug 2014 15:59:19 +0000 (11:59 -0400)
doc/index.md
luatz/tzcache.lua

index bb796417c6fd1781f9d6bc0b36c8b8e119546611..09e7d7dcce12f8a766ecbc68615aef70292dd8b4 100644 (file)
@@ -18,6 +18,7 @@ See `gettime` for more information.
 
 Returns a timezone object (see `tzinfo` documentation) for the given `timezone_name`.
 If `timezone_name` is `nil` then the local timezone is used.
 
 Returns a timezone object (see `tzinfo` documentation) for the given `timezone_name`.
 If `timezone_name` is `nil` then the local timezone is used.
+If `timezone_name` is an absolute path, then that `tzinfo` file is used
 
 This uses the local [zoneinfo database](https://www.iana.org/time-zones); 
 names are usually of the form `Country/Largest_City` e.g. "America/New_York".
 
 This uses the local [zoneinfo database](https://www.iana.org/time-zones); 
 names are usually of the form `Country/Largest_City` e.g. "America/New_York".
index 25a664dffd12e19605787959f896eae604e7d59f..98ced26947a3d84e012cf1f4099e67c44a79899b 100644 (file)
@@ -5,10 +5,12 @@ local local_zoneinfo_path = "/etc/localtime"
 local tz_cache = { }
 
 local function name_to_zoneinfo_path ( name )
 local tz_cache = { }
 
 local function name_to_zoneinfo_path ( name )
-       if name then
-               return base_zoneinfo_path .. name
-       else
+       if name == nil then
                return local_zoneinfo_path
                return local_zoneinfo_path
+       elseif name:sub ( 1 , 1 ) == "/" then
+               return name
+       else
+               return base_zoneinfo_path .. name
        end
 end
 
        end
 end