]> git.madduck.net Git - etc/awesome.git/blob - 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:

7ae1b55b6addc3b999b67ef6a31ff02cbd3daea5
[etc/awesome.git] / doc / tzinfo.md
1 # `luatz.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 `info` table, which contains information about the change at that point:
17
18   - `gmtoff` (number) The offset from GMT (UTC) in seconds
19   - `isdst` (boolean): If this change was declared as daylight savings
20   - `abbrind` (number, abbreviation id)
21   - `abbr` (string): short name for this gmt offset
22   - `isstd` (boolean)
23   - `isgmt` (boolean)
24
25 ## `:find_current ( utc_ts )`
26
27 Returns the relevant `info` table at the given utc timestamp for the given UTC timestamp.
28
29
30 ## `:localise ( utc_ts )` and `:localize ( utc_ts )`
31
32 Convert the given UTC timestamp to the timezone.
33 Returns the number of seconds since unix epoch in the given timezone.
34
35
36 ## `:utctime ( local_ts )`
37
38 Convert the given local timestamp (seconds since unix epoch in the time zone) to a UTC timestamp.
39 This may result in ambigous results, in which case multiple values are returned.
40
41 e.g. consider that when daylight savings rewinds your local clock from 3am to 2am there will be two 2:30ams.