From 8261e02a0b7cd2cca1da9ec6fdbd577c3bcbed3a Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 6 Jan 2015 16:41:56 +0100 Subject: [PATCH] Simplify `calc_timeout` with textclock Ref: https://github.com/awesomeWM/awesome/commit/8dc6fa866628605083a26a70357f762eb51644ff#commitcomment-8867170 --- lib/awful/widget/textclock.lua.in | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/awful/widget/textclock.lua.in b/lib/awful/widget/textclock.lua.in index 8537ebdf..9b6f2014 100644 --- a/lib/awful/widget/textclock.lua.in +++ b/lib/awful/widget/textclock.lua.in @@ -6,7 +6,6 @@ local setmetatable = setmetatable local os = os -local fmod = math.fmod local textbox = require("wibox.widget.textbox") local timer = require("gears.timer") @@ -17,9 +16,7 @@ local textclock = { mt = {} } -- This lowers the timeout so that it occurs "correctly". For example, a timeout -- of 60 is rounded so that it occurs the next time the clock reads ":00 seconds". local function calc_timeout(real_timeout) - local date = os.date("*t") - local date_time = (date.hour * 60 + date.min) * 60 + date.sec - return real_timeout - fmod(date_time, real_timeout) + return real_timeout - os.time() % real_timeout end --- Create a textclock widget. It draws the time it is in a textbox.