anchor.diff:      end.
   
   
  +make_archive_header(Offset, Seconds, Points) ->
  +    #archive_header{offset=Offset,
  +                   seconds=Seconds,
  +                   points=Points,
  +                   retention=Seconds * Points,
  +                   size=Points * ?POINT_SIZE}.
  +
  +
   read_archive_info(IO, Archives) ->
       ByOffset = fun(A, B) -> A#archive_header.offset =< B#archive_header.offset end,
       case read_archive_info(IO, [], Archives) of
  
positive.code: read_archive_info(IO, As, Archives) ->
      case file:read(IO, ?METADATA_ARCHIVE_HEADER_SIZE) of
          {ok, <<Offset:32/integer-unsigned-big, Secs:32/integer-unsigned-big, Points:32/integer-unsigned-big>>} ->
              Archive = #archive_header{offset=Offset,
                                       seconds=Secs,
                                       points=Points,
                                       retention=Secs*Points,
                                       size=Points*?POINT_SIZE},
              read_archive_info(IO, [Archive | As], Archives - 1);
          _Error -> error
      end.
  
negative.code:     end.
  
  
  get_data_point_offset(Archive, Interval, 0) ->
      Archive#archive_header.offset;
  get_data_point_offset(Archive, Interval, BaseInterval) ->
      Distance = Interval - BaseInterval,
      PointDistance = Distance div Archive#archive_header.seconds,
      ByteDistance = PointDistance * ?POINT_SIZE,
      Archive#archive_header.offset + (ByteDistance rem Archive#archive_header.size).
  
  
  update_point(File, Value, TimeStamp) ->
  