anchor.diff:  
   % internal API for the monitor process
   -export([get_slot_start/2, reduce_timeslots/2, add_nonexisting_timeslots/2,
  -         get_type/1, get_slot_length/1, get_current_time/1, get_value/2,
  +         get_type/1, get_slot_length/1, get_current_time/1,
  +         get_value/2, get_value_by_offset/2,
            add_with/4, timing_with_hist_merge_fun/3]).
   
   % misc
  
positive.code: 
  -spec dump_with(rrd(), dump_fun_existing(T), dump_fun_nonexisting(U)) -> [T | U].
  dump_with(DB, FunExist, FunNotExist) ->
      SlotLength = DB#rrd.slot_length,
      CurrentIndex = DB#rrd.current_index,
      Count = DB#rrd.count,
      dump_internal(DB, (CurrentIndex + 1) rem Count, CurrentIndex,
                    DB#rrd.current_time - (Count - 1) * SlotLength, [], FunExist, FunNotExist).
  
  %% @doc Merges any value of DB2 which is in the current or a future time slot
  %%      of DB1 into it and returns a new rrd.
  
negative.code:     CurrentSlot = is_current_slot(Time, CurrentTime, StepSize),
      FutureSlot = is_future_slot(Time, CurrentTime, StepSize),
      {CurrentSlot, FutureSlot}.
  
  %% @doc Goes through the rrd starting at the current slot and returns the value
  %%      that was recorded at the given time (the time must be in the time slot).
  -spec get_value_internal(rrd(), Time::internal_time(), CurrentIdx::non_neg_integer(), EndIdx::non_neg_integer(),
                      CurrentTime::internal_time()) -> data_type() | undefined.
  get_value_internal(DB, Time, EndIndex, EndIndex, CurrentTime) ->
      case is_current_slot(Time, CurrentTime, DB#rrd.slot_length) of
          true -> array:get(EndIndex, DB#rrd.data);
          _    -> undefined
      end;
  get_value_internal(DB, Time, IndexToFetch, EndIndex, CurrentTime) ->
      SlotLength = DB#rrd.slot_length,
      Count = DB#rrd.count,
      case is_current_slot(Time, CurrentTime, SlotLength) of
          true -> array:get(IndexToFetch, DB#rrd.data);
          _    -> get_value_internal(DB, Time, (IndexToFetch + Count - 1) rem Count,
                                     EndIndex, CurrentTime - SlotLength)
      end.
  
  -spec dump_internal(rrd(), CurrentIdx::non_neg_integer(), EndIdx::non_neg_integer(),
                      CurrentTime::internal_time(), Rest::[T],
  