diff --git a/README b/README index 5e1450b..c038eaf 100644 --- a/README +++ b/README @@ -265,8 +265,11 @@ vicious.widgets.weather {windkmh}, {sky}, {weather}, {tempf}, {tempc}, {humid}, {press} vicious.widgets.date - - provides access to os.date, with optional custom formatting; - provided as the format string + - provides access to os.date, with optional time formatting provided + as the format string - using regular date sequences + - takes optional time offset, in seconds, as an argument for example + to calculate time zone differences, otherwise current time is + formatted - returns the output of os.date(), formatted by provided sequences diff --git a/widgets/date.lua b/widgets/date.lua index 68a803d..d3c6ce9 100644 --- a/widgets/date.lua +++ b/widgets/date.lua @@ -5,18 +5,21 @@ --------------------------------------------------- -- {{{ Grab environment -local os = { date = os.date } local setmetatable = setmetatable +local os = { + date = os.date, + time = os.time +} -- }}} --- Date: provides access to os.date with optional custom formatting +-- Date: provides access to os.date with optional time formatting module("vicious.widgets.date") -- {{{ Date widget type -local function worker(format) - return os.date(format or nil) +local function worker(format, warg) + return os.date(format or nil, warg and os.time()+warg or nil) end -- }}}