From: daurnimator Date: Fri, 30 Aug 2013 18:27:55 +0000 (-0400) Subject: src/timetable: Have `unpack_tm` and `new_timetable` optionally take/return yday and... X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/e53b211c9263cce412e0663563e119ad2ab2db10 src/timetable: Have `unpack_tm` and `new_timetable` optionally take/return yday and wday --- diff --git a/src/timetable.lua b/src/timetable.lua index aef8ca4..a5d0cc7 100644 --- a/src/timetable.lua +++ b/src/timetable.lua @@ -75,7 +75,9 @@ local function unpack_tm ( tm ) assert ( tm.day , "day required" ) , tm.hour or 12 , tm.min or 0 , - tm.sec or 0 + tm.sec or 0 , + tm.yday , + tm.wday end -- Modify parameters so they all fit within the "normal" range @@ -164,7 +166,7 @@ local function cast_timetable ( tm ) return setmetatable ( tm , timetable_mt ) end -local function new_timetable ( year , month , day , hour , min , sec ) +local function new_timetable ( year , month , day , hour , min , sec , yday , wday ) return cast_timetable { year = year ; month = month ; @@ -172,6 +174,8 @@ local function new_timetable ( year , month , day , hour , min , sec ) hour = hour ; min = min ; sec = sec ; + yday = yday ; + wday = wday ; } end