anchor.diff:  last_chunk(Tab, TS, Step, Samples) ->
       Samples1 = [hd(mnesia:read(Tab, TS))|Samples],
       TS1 = mnesia:prev(Tab, TS),
  -    T = trunc_ts(TS, Step),
  -    case TS1 == '$end_of_table' orelse trunc_ts(TS1, Step) /= T of
  +    T = misc:trunc_ts(TS, Step),
  +    case TS1 == '$end_of_table' orelse misc:trunc_ts(TS1, Step) /= T of
           false ->
               last_chunk(Tab, TS1, Step, Samples1);
           true ->
  
positive.code:     {ok, #state{bucket=Bucket}}.
  
  
  handle_call({latest, Period, Bucket}, _From, State) ->
      Reply = try mnesia:activity(
                    async_dirty,
                    fun () ->
                            Tab = table(Bucket, Period),
                            Key = mnesia:last(Tab),
                            hd(mnesia:read(Tab, Key))
                    end, []) of
                  Result ->
                      {ok, Result}
              catch
                  Type:Err -> {error, {Type, Err}}
              end,
      {reply, Reply, State};
  handle_call({latest, Period, Bucket, N}, _From, State) ->
      Reply = fetch_latest(Bucket, Period, N),
      {reply, Reply, State};
  handle_call({latest, Period, Bucket, Step, N}, _From, State) ->
      Reply = resample(Bucket, Period, Step, N),
      {reply, Reply, State}.
  
  
  handle_cast(unhandled, unhandled) ->
      unhandled.
  
  
  handle_info({stats, Bucket, Sample}, State = #state{bucket=Bucket}) ->
  
negative.code: 
  start_link(Bucket) ->
      gen_server:start_link({local, server(Bucket)}, ?MODULE, Bucket, []).
  
  
  %%
  