summaryrefslogtreecommitdiff
path: root/lib/logger.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/logger.rb')
-rw-r--r--lib/logger.rb17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/logger.rb b/lib/logger.rb
index ef9c75d068c..ca667f48b4a 100644
--- a/lib/logger.rb
+++ b/lib/logger.rb
@@ -714,29 +714,26 @@ private
when /^monthly$/
t = Time.mktime(now.year, now.month, 1) + SiD * 31
mday = (1 if t.mday > 1)
- if mday
- t = Time.mktime(t.year, t.month, mday)
- end
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)))
+ end
t
end
def previous_period_end(now, shift_age)
case shift_age
when /^daily$/
- eod(now - 1 * SiD)
+ t = Time.mktime(now.year, now.month, now.mday) - SiD / 2
when /^weekly$/
- eod(now - ((now.wday + 1) * SiD))
+ t = Time.mktime(now.year, now.month, now.mday) - (SiD * (now.wday + 1) + SiD / 2)
when /^monthly$/
- eod(now - now.mday * SiD)
+ t = Time.mktime(now.year, now.month, 1) - SiD / 2
else
- now
+ return now
end
- end
-
- def eod(t)
Time.mktime(t.year, t.month, t.mday, 23, 59, 59)
end
end