anchor.diff:          _ -> 
               false
       end.
  +    
  +%%--------------------------------------------------------------------
  +%% Func: update_late_list/3
  +%% Description: if status is later add to list.
  +%%--------------------------------------------------------------------
  +update_later_list(SSecs, S, Late) ->
  +    {LatestSecs, _} ,
  +    if
  +        SSecs >= LatestSecs ->
  +            gb_trees:insert(SSecs, S, Late),
  +            gb_trees:take_smallest(Late);
  +        true ->
  +            Late
  +    end.
  
positive.code:     S;
  
  older(S, Old) ->  
      SDSecs  = date_to_gregorian_seconds(S),
      OldSecs = date_to_gregorian_seconds(Old),
      if 
           SDSecs < OldSecs ->
              S;
          true -> 
              Old
      end.
  
  %%--------------------------------------------------------------------
  %% Func: older/2
  %% Description: return later status
  %%--------------------------------------------------------------------
  later(S, {}) ->  
      S;
  
  later(S, Late) ->  
      SDSecs   = date_to_gregorian_seconds(S),
      LateSecs = date_to_gregorian_seconds(Late),
      if 
           SDSecs > LateSecs ->
              S;
          true -> 
              Late
      end.
  
  %%--------------------------------------------------------------------
  
negative.code:             later(S, Late)
          end, 
          {}, 
          qlc:q([S || S <- mnesia:table(laconica_statuses), S#laconica_statuses.site =:= Site]));
  
  %% return latest count of statuses
  latest({count, Count}) ->      
      webgnosus_dbi:map(
          fun(S, Late) ->  
              later(S, Late, Count)
          end, 
          [], 
          qlc:q([S || S <- mnesia:table(laconica_statuses)]));
  
  %% return latest count of statuses for specified site
  latest({{site, Site}, {count, Count}}) ->      
      webgnosus_dbi:map(
          fun(S, Late) ->  
              later(S, Late, Count)
          end, 
          [], 
          qlc:q([S || S <- mnesia:table(laconica_statuses), S#laconica_statuses.site =:= Site])).
  
  %%====================================================================
  