diff options
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | widgets/date.lua | 7 |
2 files changed, 9 insertions, 5 deletions
@@ -266,9 +266,10 @@ vicious.widgets.weather vicious.widgets.date - provides access to os.date, with optional time formatting provided - as the format string - - takes optional time as an argument, for example to calculate - time-zone differences, otherwise it formats the current time + 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 b20e43f..d3c6ce9 100644 --- a/widgets/date.lua +++ b/widgets/date.lua @@ -5,8 +5,11 @@ --------------------------------------------------- -- {{{ Grab environment -local os = { date = os.date } local setmetatable = setmetatable +local os = { + date = os.date, + time = os.time +} -- }}} @@ -16,7 +19,7 @@ module("vicious.widgets.date") -- {{{ Date widget type local function worker(format, warg) - return os.date(format or nil, warg or nil) + return os.date(format or nil, warg and os.time()+warg or nil) end -- }}} |