diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-26 14:51:39 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-26 14:51:39 +0000 |
commit | 6160e4b9f4be0835a59874863de79b066fde1b2c (patch) | |
tree | b9231fde9504c2b9146b798eef509d2c647c3e00 | |
parent | aeb88f01eb1c4e20f41236daef869bd0109d943b (diff) | |
download | ruby-6160e4b9f4be0835a59874863de79b066fde1b2c.tar.gz |
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
-rw-r--r-- | lib/logger.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/logger.rb b/lib/logger.rb index 14dd71cd62..bb4953e437 100644 --- a/lib/logger.rb +++ b/lib/logger.rb @@ -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 |