From e53b211c9263cce412e0663563e119ad2ab2db10 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 30 Aug 2013 14:27:55 -0400 Subject: [PATCH] src/timetable: Have `unpack_tm` and `new_timetable` optionally take/return yday and wday --- src/timetable.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 -- 2.39.5