Skip to content

Instantly share code, notes, and snippets.

@airtonix
Created July 15, 2009 22:09
Show Gist options
  • Save airtonix/148028 to your computer and use it in GitHub Desktop.
Save airtonix/148028 to your computer and use it in GitHub Desktop.
do
local HOUR = 60*60
local zones = {
{ "EDT", HOUR * 13.5 },
{ "CDT", HOUR * 14.5},
{ "MDT", HOUR * 15.5},
{ "PDT", HOUR * 16.5},
{ "PST", HOUR * 17.5},
{ "AKDT", HOUR * 18.5},
{ "HAST", HOUR * 19.5},
}
local pad = function(s, width, padder)
padder = string.rep(padder or " ", math.abs(width))
if width < 0 then return string.strsub(padder .. s, width) end
return string.sub(s .. padder, 1, width)
end
local tinsert = table.insert
function conky_time_zones(arg)
local output = {}
local time
for index,timezone in pairs(zones)do
tinsert(output,os.date(pad(timezone[1], 4, " ").." %a %d %b ${color1}%H:%M${color5}%p",os.time()-timezone[2]) )
end
return table.concat(output,"\n")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment