class ScoutApm::StoreReportingPeriodTimestamp
A timestamp, normalized to the beginning of a minute. Used as a hash key to bucket metrics into per-minute groups
Attributes
Public Class Methods
Source
# File lib/scout_apm/store.rb, line 159 def self.minutes_ago(min, base_time=Time.now) adjusted = base_time - (min * 60) new(adjusted) end
Source
# File lib/scout_apm/store.rb, line 154 def initialize(time=Time.now) @raw_time = time.utc # The actual time passed in. Store it so we can to_s it without reparsing a timestamp @timestamp = @raw_time.to_i - @raw_time.sec # The normalized time (integer) to compare by end
Public Instance Methods
Source
# File lib/scout_apm/store.rb, line 192 def age_in_seconds Time.now.to_i - timestamp end
Source
# File lib/scout_apm/store.rb, line 180 def eql?(o) self.class == o.class && timestamp.eql?(o.timestamp) end
Source
# File lib/scout_apm/store.rb, line 168 def strftime(pattern=nil) if pattern.nil? to_time.iso8601 else to_time.strftime(pattern) end end