swh:1:snp:d91631a580497fff421f83ef3e706159a0d67602
Raw File
Tip revision: ca0cbd288f03c7a29050b3d6698a96b45ccfa4b2 authored by Marko Laine on 15 August 2021, 17:59:37 UTC
cleanup
Tip revision: ca0cbd2
elapsed.m
function y=elapsed(t)
%ELAPSED  Time elapsed as a string since t or since last tic


% Marko Laine <marko.laine@fmi.fi>
% $Revision: 1.4 $  $Date: 2012/09/27 11:47:35 $

if nargin<1
   t=toc;
end
secs = t;
mins = floor(secs/60);
secs = floor(secs - 60*mins);
hrs  = floor(mins/60);
mins = mins - hrs*60;
  e=sprintf('%g:%02g:%02g',hrs,mins,secs);
if nargout>0
  y=e;
else
  disp(e)
end
back to top