- [luasocket](http://w3.impa.br/~diego/software/luasocket/)'s `socket.gettime`
- [`os.time`](http://www.lua.org/manual/5.2/manual.html#pdf-os.time)
-## `source`
+### `source`
The library/function currently in use.
-## `resolution`
+### `resolution`
The smallest time resolution (in seconds) available from `gettime ( )` .
-## `gettime ( )`
+### `gettime ( )`
Returns the number of seconds since unix epoch (1970-01-01T00:00:00Z) as a lua number
- `timetable`: Class for date/time objects supporting normalisation
-## `time ( )`
+### `time ( )`
Returns the current unix timestamp using the most precise source available.
See `gettime` for more information.
-## `get_tz ( [timezone_name] )`
+### `get_tz ( [timezone_name] )`
Returns a timezone object (see `tzinfo` documentation) for the given `timezone_name`.
If `timezone_name` is `nil` then the local timezone is used.
Check [wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for an example list.
-## `time_in ( timezone_name [, utc_ts] )`
+### `time_in ( timezone_name [, utc_ts] )`
Returns the current time in seconds since 1970-01-01 0:00:00 in the given timezone as a string,
(same semantics as `get_tz`) at the given UTC time (defaults to now).
Functions take the source string and an optional initial postition.
-## `rfc_3339 ( string [, init] )`
+### `rfc_3339 ( string [, init] )`
Returns a luatz timetable and the (optional) time zone offset in seconds
Equality and comparisons should work between timetable objects.
-## `new ( year , month , day , hour , min , sec , [yday] , [wday] )`
+### `new ( year , month , day , hour , min , sec , [yday] , [wday] )`
Returns a new timetable with the given contents.
-## `new_from_timestamp ( timestamp )`
+### `new_from_timestamp ( timestamp )`
Returns a new (normalised) timetable, given a timestamp in seconds since the unix epoch of
1970-01-01.
-## `:clone ( )`
+### `:clone ( )`
Returns a new independent instance of an existing timetable object.
-## `:normalise ( )`
+### `:normalise ( )`
Mutates the current object's time and date components so that they lie within 'normal'
ranges e.g. `month` is `1`-`12`; `min` is `0`-`59`
-## `:rfc_3339 ( )` and `__tostring` metamethod
+### `:rfc_3339 ( )` and `__tostring` metamethod
Returns the timetable formatted as an rfc-3339 style string.
The timezone offset (or Z) is not appended.
`:normalise ( )` should be called first.
-## `:timestamp ( )`
+### `:timestamp ( )`
Returns the timetable as the number of seconds since unix epoch (1970-01-01) as a lua number.
-## `:unpack ( )`
+### `:unpack ( )`
Unpacks the timetable object; returns `year`, `month`, `day`, `hour`, `min`, `sec`, `yday`, `wday`
- `isgmt` (boolean)
-## `:find_current ( utc_ts )`
+### `:find_current ( utc_ts )`
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 )`
Convert the given UTC timestamp to the timezone.
Returns the number of seconds since unix epoch in the given timezone.
-## `:utctime ( local_ts )`
+### `:utctime ( local_ts )`
Convert the given local timestamp (seconds since unix epoch in the time zone) to a UTC timestamp.
This may result in ambigous results, in which case multiple values are returned.