module Logger::Period
def previous_period_end(now, shift_age)
def previous_period_end(now, shift_age) case shift_age when 'daily' t = Time.mktime(now.year, now.month, now.mday) - SiD / 2 when 'weekly' t = Time.mktime(now.year, now.month, now.mday) - (SiD * now.wday + SiD / 2) when 'monthly' t = Time.mktime(now.year, now.month, 1) - SiD / 2 when 'now', 'everytime' return now else raise ArgumentError, "invalid :shift_age #{shift_age.inspect}, should be daily, weekly, monthly, or everytime" end Time.mktime(t.year, t.month, t.mday, 23, 59, 59) end