instance method
since
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
since(seconds)
Returns a new Time representing the time a number of seconds since the instance time, this is basically a wrapper around the Numeric extension.
Parameters
-
secondsreq
Source
# File activesupport/lib/active_support/core_ext/time/calculations.rb, line 126
def since(seconds)
f = seconds.since(self)
if ActiveSupport::Duration === seconds
f
else
initial_dst = self.dst? ? 1 : 0
final_dst = f.dst? ? 1 : 0
(seconds.abs >= 86400 && initial_dst != final_dst) ? f + (initial_dst - final_dst).hours : f
end
rescue
self.to_datetime.since(seconds)
end
Defined in activesupport/lib/active_support/core_ext/time/calculations.rb line 126
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::CoreExtensions::Time::Calculations