mod_firewall/conditions.lib.lua
changeset 997 69dd4e4e54a2
parent 979 cec42f884475
child 2040 7ba6ed553c93
equal deleted inserted replaced
996:37af655ca575 997:69dd4e4e54a2
   111 
   111 
   112 local day_numbers = { sun = 0, mon = 2, tue = 3, wed = 4, thu = 5, fri = 6, sat = 7 };
   112 local day_numbers = { sun = 0, mon = 2, tue = 3, wed = 4, thu = 5, fri = 6, sat = 7 };
   113 
   113 
   114 local function current_time_check(op, hour, minute)
   114 local function current_time_check(op, hour, minute)
   115 	hour, minute = tonumber(hour), tonumber(minute);
   115 	hour, minute = tonumber(hour), tonumber(minute);
   116 	local s = "";
       
   117 	local adj_op = op == "<" and "<" or ">="; -- Start time inclusive, end time exclusive
   116 	local adj_op = op == "<" and "<" or ">="; -- Start time inclusive, end time exclusive
   118 	if minute == 0 then
   117 	if minute == 0 then
   119 		return "(current_hour"..adj_op..hour..")";
   118 		return "(current_hour"..adj_op..hour..")";
   120 	else
   119 	else
   121 		return "((current_hour"..op..hour..") or (current_hour == "..hour.." and current_minute"..adj_op..minute.."))";
   120 		return "((current_hour"..op..hour..") or (current_hour == "..hour.." and current_minute"..adj_op..minute.."))";