]>
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:
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (parent:
1efce44 )
The table contains a sequence of tables that describe the timezone at a given point
using a `transition_time`: the unix timestamp (in UTC) that this definition starts, and
The table contains a sequence of tables that describe the timezone at a given point
using a `transition_time`: the unix timestamp (in UTC) that this definition starts, and
-a `info` table, which contains information about the change at that point:
+a `tt_info` object.
+
+A `tt_info` object contains information about a time offset;
+and contains the following fields:
- `gmtoff` (number) The offset from GMT (UTC) in seconds
- `isdst` (boolean): If this change was declared as daylight savings
- `gmtoff` (number) The offset from GMT (UTC) in seconds
- `isdst` (boolean): If this change was declared as daylight savings
- `isstd` (boolean)
- `isgmt` (boolean)
- `isstd` (boolean)
- `isgmt` (boolean)
## `:find_current ( utc_ts )`
## `:find_current ( utc_ts )`
-Returns the relevant `info` table at the given utc timestamp for the given UTC timestamp .
+Returns the relevant `tt_info` object for the given UTC timestamp in the timezone .
## `:localise ( utc_ts )` and `:localize ( utc_ts )`
## `:localise ( utc_ts )` and `:localize ( utc_ts )`
local tz_info_mt = require "luatz.tzinfo".tz_info_mt
local tz_info_mt = require "luatz.tzinfo".tz_info_mt
+local tt_info_mt = require "luatz.tzinfo".tt_info_mt
+
local function read_int32be ( fd )
local data , err = fd:read ( 4 )
local function read_int32be ( fd )
local data , err = fd:read ( 4 )
v.abbr = abbreviations:sub ( v.abbrind+1 , v.abbrind+3 )
v.isstd = isstd [ i ] or false
v.isgmt = isgmt [ i ] or false
v.abbr = abbreviations:sub ( v.abbrind+1 , v.abbrind+3 )
v.isstd = isstd [ i ] or false
v.isgmt = isgmt [ i ] or false
+ setmetatable ( v , tt_info_mt )
local tz_info_mt = {
__index = tz_info_methods ;
}
local tz_info_mt = {
__index = tz_info_methods ;
}
-- Binary search
local function _find_current ( tzinfo , target , i , j )
-- Binary search
local function _find_current ( tzinfo , target , i , j )
return {
tz_info_mt = tz_info_mt ;
return {
tz_info_mt = tz_info_mt ;
+ tt_info_mt = tt_info_mt ;