X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/cce108c5533a9c7386949a4fd008b73638247177..98480fae7ef1afd7925d4f1d45fdefa5f3a7e475:/doc/timetable.md diff --git a/doc/timetable.md b/doc/timetable.md index 86ce2b2..845c787 100644 --- a/doc/timetable.md +++ b/doc/timetable.md @@ -15,51 +15,47 @@ The fields are intentionally compatible with the lua standard library's `os.date - `wday` (optional) timetable components may be outside of their standard range (e.g. a month component of -14) to faciliate arithmetic operations on date components. `:normalise ( )` can be +14) to facilitate arithmetic operations on date components. `:normalise ( )` can be called to modify components to return to their standard range. 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 timetable given a timestamp in seconds since the unix epoch of +Returns a new (normalised) timetable, given a timestamp in seconds since the unix epoch of 1970-01-01. -`:normalise ( )` should probably be called before use to resolve to the current time and -date. +### `:clone ( )` -## `:clone ( )` +Returns a new independent instance of an existing timetable object. -Returns a new independant 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. -The ranges of components are not checked, and if you want a valid timestamp, `:normalise -( )` should be called first. +The ranges of components are not checked, if you want a valid timestamp, +`: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. +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`