% FUNCTION CHRONO = CHRONO_START(N, [INTERVAL], [LOGFILE_FID])
%
% To create a chrono object, used to chronometer a task.
%
% n: integer, total number of iterations to accomplish task.
% interval: float, minimum interval between two printouts, default 10 sec
% 
% chrono: chrono object to be reused with chrono_check().
%
% By Guillaume Lathoud 2006
% lathoud@idiap.ch

function chrono = chrono_start(n, interval, logfile_fid)

if nargin < 1
  error('Need at least 1 parameter');
end

if nargin < 2
  interval = [];
end

if isempty( interval )
  interval = 10;
end

if nargin < 3
  logfile_fid = [];  % By default verbosity will go on the standard output
end

chrono.n              = n;
chrono.interval       = interval;
chrono.start_time     = 1e5 * now;
chrono.previous_time  = chrono.start_time;
chrono.logfile_fid    = logfile_fid;
