% FIXNSECS fixes the numer of seconds.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: fixes the numer of seconds.
%
% CALL:        d    = fixNsecs(d)
%
% INPUT:       d - tsdata object
%
% OUTPUT:      d - tsdata object
%
% VERSION:     $Id: fixNsecs.m,v 1.4 2011/02/18 16:48:55 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = fixNsecs(varargin)

  obj = varargin{1};

  %%% decide whether we modify the pz-object, or create a new one.
  obj = copy(obj, nargout);

  if isempty(obj.x)
    obj.nsecs = length(obj.y)/obj.fs;
  else
    obj.nsecs = obj.x(end)-obj.x(1) + 1/obj.fs;
  end

  varargout{1} = obj;
end

