anchor.diff:                  _ -> % PastTimeSlot; ignore
                       DB
               end
  -    end.
  -
  --spec update_with(rrd(), CurrentIndex::non_neg_integer(), Time::internal_time(), NewV, update_fun(data_type(), NewV)) -> rrd().
  -update_with(DB, CurrentIndex, Time, NewValue, F) ->
  -    case array:get(CurrentIndex, DB#rrd.data) of
  -        undefined ->
  -            DB#rrd{data = array:set(CurrentIndex, F(Time, undefined, NewValue), DB#rrd.data)};
  -        OldValue ->
  -            DB#rrd{data = array:set(CurrentIndex, F(Time, OldValue, NewValue), DB#rrd.data)}
       end.
   
   -spec fill(array(), fill_policy_type(), pos_integer(), non_neg_integer(), non_neg_integer(), data_type() | undefined) -> array().
  
positive.code:     case is_current_slot(Time, CurrentTime, SlotLength) of
          true ->
              CurrentIndex = DB#rrd.current_index,
              update_with(DB, CurrentIndex, Time, Value, F);
          _ ->
              case is_future_slot(Time, CurrentTime, SlotLength) of
                  true ->
                      Count = DB#rrd.count,
                      CurrentIndex = DB#rrd.current_index,
                      FillPolicy = DB#rrd.fill_policy,
                      Delta = (Time - CurrentTime) div SlotLength,
                              NewIndex = (CurrentIndex + Delta) rem Count,
                      FilledData =
                          case Delta > Count of
                              true when FillPolicy =:= set_undefined ->
  
negative.code:                                 array:new(Count);
                              true ->
                                  % fill everything:
                                  fill(Data, FillPolicy, Count,
                                       (CurrentIndex + 1) rem Count,
                                       CurrentIndex,
                                       array:get(CurrentIndex, Data));
                              _ ->
                                  fill(Data, FillPolicy, Count,
                                       (CurrentIndex + 1) rem Count,
                                       NewIndex,
                                       array:get(CurrentIndex, Data))
                          end,
                      DB#rrd{data = array:set(NewIndex, F(Time, undefined, Value), FilledData),
                             current_index = NewIndex,
  