local gears = require("gears") local wibox = require("wibox") local math = require("math") local luatz = require("luatz") local tblutils = require("tblutils") local module = {} local function get_textclocks_for_timezones(zones) local now = math.floor(luatz.time_in(nil)) local ret = {} for c, tz in tblutils.sorted_pairs(zones) do local t = math.floor(luatz.time_in(tz)) if math.abs(os.difftime(t, now)) > 10 then local widget = wibox.widget.textclock(c .. ": %H:%M (%a)", 60, tz) ret[#ret+1] = widget end end return ret end function module.get_clocksarray(strftime, zones, spacer) local ret = {} local zoneclocks = get_textclocks_for_timezones(zones) for i, c in ipairs(zoneclocks) do ret[#ret+1] = c if spacer then ret[#ret+1] = spacer end end ret[#ret+1] = wibox.widget.textclock(strftime, 1) return ret end return module