From 66d1ace8410db940b6d1c74986626557ef8098ba Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 24 Nov 2013 04:32:39 -0500 Subject: [PATCH] tzinfo: Add localise as alias for localize --- doc/tzinfo.md | 2 +- luatz/tzinfo.lua | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/tzinfo.md b/doc/tzinfo.md index d989102..7ae1b55 100644 --- a/doc/tzinfo.md +++ b/doc/tzinfo.md @@ -27,7 +27,7 @@ a `info` table, which contains information about the change at that point: Returns the relevant `info` table at the given utc timestamp for the given UTC timestamp. -## `:localize ( utc_ts )` +## `:localise ( utc_ts )` and `:localize ( utc_ts )` Convert the given UTC timestamp to the timezone. Returns the number of seconds since unix epoch in the given timezone. diff --git a/luatz/tzinfo.lua b/luatz/tzinfo.lua index fd3f5e8..11248ad 100644 --- a/luatz/tzinfo.lua +++ b/luatz/tzinfo.lua @@ -55,10 +55,11 @@ function tz_info_methods:find_current ( current ) return self [ _find_current ( self , current , 0 , #self ) ].info end -function tz_info_methods:localize ( utc_ts ) +function tz_info_methods:localise ( utc_ts ) utc_ts = utc_ts or gettime ( ) return utc_ts + self:find_current ( utc_ts ).gmtoff end +tz_info_methods.localize = tz_info_methods.localise function tz_info_methods:utctime ( ts_local ) local tz1 , tz2 = find_current_local ( self , ts_local ) -- 2.39.2