vicious/widgets/date_all.lua

28 lines
711 B
Lua
Raw Normal View History

2009-09-29 22:33:19 +02:00
---------------------------------------------------
-- Licensed under the GNU General Public License v2
2010-01-02 21:21:54 +01:00
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
-- * (c) 2009, Lucas de Vries <lucas@glacicle.com>
2009-09-29 22:33:19 +02:00
---------------------------------------------------
-- {{{ Grab environment
local setmetatable = setmetatable
local os = {
date = os.date,
time = os.time
}
-- }}}
-- Date: provides access to os.date with optional time formatting
-- vicious.widgets.date
2017-01-25 17:50:29 +01:00
local date_all = {}
-- {{{ Date widget type
local function worker(format, warg)
return os.date(format or nil, warg and os.time()+warg or nil)
end
-- }}}
2017-01-25 17:50:29 +01:00
return setmetatable(date_all, { __call = function(_, ...) return worker(...) end })