* lib/logger.rb ({next,previous}_rotate_time): dispatch by exact
  matching shift_age instead of regexp matching.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-10-26 14:51:39 +00:00
Родитель aeb88f01eb
Коммит 6160e4b9f4
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -533,11 +533,11 @@ private
def next_rotate_time(now, shift_age)
case shift_age
when /^daily$/
when 'daily'
t = Time.mktime(now.year, now.month, now.mday) + SiD
when /^weekly$/
when 'weekly'
t = Time.mktime(now.year, now.month, now.mday) + SiD * (7 - now.wday)
when /^monthly$/
when 'monthly'
t = Time.mktime(now.year, now.month, 1) + SiD * 31
mday = (1 if t.mday > 1)
else
@ -551,11 +551,11 @@ private
def previous_period_end(now, shift_age)
case shift_age
when /^daily$/
when 'daily'
t = Time.mktime(now.year, now.month, now.mday) - SiD / 2
when /^weekly$/
when 'weekly'
t = Time.mktime(now.year, now.month, now.mday) - (SiD * (now.wday + 1) + SiD / 2)
when /^monthly$/
when 'monthly'
t = Time.mktime(now.year, now.month, 1) - SiD / 2
else
return now