зеркало из https://github.com/github/ruby.git
logger.rb: exact matching
* 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:
Родитель
aeb88f01eb
Коммит
6160e4b9f4
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче