logger.rb: fix weekly rotation

* lib/logger.rb (Logger::Period#next_rotate_time): get rid of
  adding to mday not to exceed the days of the month.
  [ruby-core:71185] [Bug #11620]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-10-27 03:00:38 +00:00
parent 6160e4b9f4
commit e8c00b7027
3 changed files with 42 additions and 4 deletions

View file

@ -539,12 +539,14 @@ private
t = Time.mktime(now.year, now.month, now.mday) + SiD * (7 - now.wday)
when 'monthly'
t = Time.mktime(now.year, now.month, 1) + SiD * 31
mday = (1 if t.mday > 1)
return Time.mktime(t.year, t.month, 1) if t.mday > 1
else
return now
end
if mday or t.hour.nonzero? or t.min.nonzero? or t.sec.nonzero?
t = Time.mktime(t.year, t.month, mday || (t.mday + (t.hour > 12 ? 1 : 0)))
if t.hour.nonzero? or t.min.nonzero? or t.sec.nonzero?
hour = t.hour
t = Time.mktime(t.year, t.month, t.mday)
t += SiD if hour > 12
end
t
end