X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/12c2ccfd35d0862f3c78d02c86859926a4f312cf..8ce2a7db5c4ea48a342b665385a54514c79d30bb:/luatz/init.lua?ds=inline diff --git a/luatz/init.lua b/luatz/init.lua index 91c95dd..8ab7cfc 100644 --- a/luatz/init.lua +++ b/luatz/init.lua @@ -17,4 +17,19 @@ _M.time_in = function ( tz , now ) return _M.get_tz ( tz ):localize ( now ) end +--- C-like functions + +_M.gmtime = function ( ts ) + return _M.timetable.new_from_timestamp ( ts ):normalise ( ) +end + +_M.localtime = function ( ts ) + ts = _M.time_in ( nil , ts ) + return _M.gmtime ( ts ) +end + +_M.ctime = function ( ts ) + return _M.strftime.asctime ( _M.localtime ( ts ) ) +end + return _M