]> git.madduck.net Git - etc/awesome.git/blob - .config/awesome/modules/luatz/doc/tzinfo.md

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:

move to screen hotkey
[etc/awesome.git] / .config / awesome / modules / luatz / doc / tzinfo.md
1 ## `luatz.tzinfo` <!-- --> {#tzinfo}
2
3 Provides a metatable for the timezone class.
4
5 Created in `luatz.tzfile` and managed by `luatz.tzcache`;
6 a timezone object contains information about a timezone.
7 These objects are based on the information available in a "zoneinfo" file.
8
9 Timezone objects should be considered opaque and immutable;
10 so the following details can be skipped over.
11
12 ------------------------------------------------------------------------------
13
14 The table contains a sequence of tables that describe the timezone at a given point
15 using a `transition_time`: the unix timestamp (in UTC) that this definition starts, and
16 a `tt_info` object.
17
18 A `tt_info` object contains information about a time offset;
19 and contains the following fields:
20
21   - `gmtoff` (number) The offset from GMT (UTC) in seconds
22   - `isdst` (boolean): If this change was declared as daylight savings
23   - `abbrind` (number, abbreviation id)
24   - `abbr` (string): short name for this gmt offset
25   - `isstd` (boolean)
26   - `isgmt` (boolean)
27
28
29 ### `tzinfo:find_current(utc_ts)` <!-- --> {#tzinfo:find_current}
30
31 Returns the relevant `tt_info` object for the given UTC timestamp in the timezone.
32
33
34 ### `tzinfo:localise(utc_ts)` and `tzinfo:localize(utc_ts)` <!-- --> {#tzinfo:localise}
35
36 Convert the given UTC timestamp to the timezone.
37 Returns the number of seconds since unix epoch in the given timezone.
38
39
40 ### `tzinfo:utctime(local_ts)` <!-- --> {#tzinfo:utctime}
41
42 Convert the given local timestamp (seconds since unix epoch in the time zone) to a UTC timestamp.
43 This may result in ambigous results, in which case multiple values are returned.
44
45 e.g. consider that when daylight savings rewinds your local clock from 3am to 2am there will be two 2:30ams.