]>
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:
0c40603 )
## `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
-`:normalise ( )` should probably be called before use to resolve to the current time and
-date.
-
-- We do this a few times ==> Convert a timestamp to timetable and normalise
local function ts2tt ( ts )
-- We do this a few times ==> Convert a timestamp to timetable and normalise
local function ts2tt ( ts )
- return luatz.timetable.new_from_timestamp ( ts ):normalise ( )
+ return luatz.timetable.new_from_timestamp ( ts )
end
-- Get the current time in UTC
end
-- Get the current time in UTC
else -- Localtime
timestamp = get_tz ( ):localise ( timestamp )
end
else -- Localtime
timestamp = get_tz ( ):localise ( timestamp )
end
- local tt = new_from_timestamp ( timestamp ):normalise ( )
+ local tt = new_from_timestamp ( timestamp )
if format_string == "*t" then
return tt
else
if format_string == "*t" then
return tt
else
--- C-like functions
_M.gmtime = function ( ts )
--- C-like functions
_M.gmtime = function ( ts )
- return _M.timetable.new_from_timestamp ( ts ):normalise ( )
+ return _M.timetable.new_from_timestamp ( ts )
end
_M.localtime = function ( ts )
end
_M.localtime = function ( ts )
if type ( ts ) ~= "number" then
error ( "bad argument #1 to 'new_from_timestamp' (number expected, got " .. type ( ts ) .. ")" , 2 )
end
if type ( ts ) ~= "number" then
error ( "bad argument #1 to 'new_from_timestamp' (number expected, got " .. type ( ts ) .. ")" , 2 )
end
- return new_timetable ( 1970 , 1 , 1 , 0 , 0 , ts )
+ return new_timetable ( 1970 , 1 , 1 , 0 , 0 , ts ):normalise ( )