No longer trap fatal signals
[notion/jeffpc.git] / utils / ion-statusd / statusd_date.lua
blob7331114b008ed847bd6144cd7babcd102fa0f675
1 --
2 -- ion/mod_statusbar/ion-statusd/statusd_date.lua
3 --
4 -- Copyright (c) Tuomo Valkonen 2004-2009.
5 --
6 -- See the included file LICENSE for details.
7 --
10 local timer
12 local defaults={
13 date_format='%a %Y-%m-%d %H:%M',
14 formats={},
17 local settings=table.join(statusd.get_config('date'), defaults)
19 local function update()
20 local tm=os.time()
21 statusd.inform('date', os.date(settings.date_format, tm))
22 for k, f in pairs(settings.formats) do
23 statusd.inform('date_'..k, os.date(f, tm))
24 end
25 return tm
26 end
28 local function timer_handler(tmr)
29 local tm=update()
31 local t=os.date('*t', tm)
32 local d=(60-t.sec)*1000
34 timer:set(d, timer_handler)
35 end
37 timer=statusd.create_timer()
38 timer_handler(timer)