lib/pulse_meter/sensor/timeline.rb
# Makes interval optimization so that the requested timespan contains less than MAX_TIMESPAN_POINTS values
# @param start_time [Fixnum] unix timestamp of timespan start
# @param end_time [Fixnum] unix timestamp of timespan start
# @return [Fixnum] optimized interval in seconds.
Makes interval optimization so that the requested timespan contains less than MAX_TIMESPAN_POINTS values
Makes interval optimization so that the requested timespan contains less than MAX_TIMESPAN_POINTS values
def optimized_interval(start_time, end_time, skip_optimization = false)
        res_interval = interval
        return res_interval if skip_optimization
        timespan = end_time - start_time
        while timespan / res_interval > MAX_TIMESPAN_POINTS - 1
          res_interval *= 2
        end
        res_interval
      end
def optimized_interval ( start_time , end_time , skip_optimization = false ) res_interval = interval return res_interval if skip_optimization timespan = end_time - start_time while timespan / res_interval > MAX_TIMESPAN_POINTS - 1 res_interval *= 2 end res_interval end
Makes interval optimization so that the requested timespan contains less than MAX_TIMESPAN_POINTS values
Makes interval optimization so that the requested timespan contains less than MAX_TIMESPAN_POINTS values
optimized interval in seconds.
optimized interval in seconds .
Fixnum
start_time
unix timestamp of timespan start
unix timestamp of timespan start
end_time
unix timestamp of timespan start
unix timestamp of timespan start
skip_optimization
<not_specific>