%
disp(' ');
disp(' hrminsec.m   ver 1.2   January 16, 2007 ');
disp(' By Tom Irvine   Email: tomirvine@aol.com ');
disp(' ');
%
disp(' Select analysis type ');
disp('  1=convert sec to hr:min:sec ');
disp('  2=convert hr:min:sec to sec');
ia=input('');
%
if(ia==1)
    a=input(' Enter time (sec) ');
    b=a/60;
    c=b/60;
%
    bb=sprintf('%8.0f',b-0.5);
    cc=sprintf('%8.0f',c-0.5);
%
    bbb=str2num(bb);
    ccc=str2num(cc);
    residual=a-ccc*3600;
    ccc;
    residual=residual/60;
    rr=sprintf('%8.0f',residual-0.5);
    rrr=str2num(rr);
%
    residual=a-ccc*3600-rrr*60;
    string=sprintf('\n %7g hr %3g min %3g sec',ccc,rrr,residual);
    disp(string)
else
    hr=input(' Enter hours ');
    min=input(' Enter minutes ');
    sec=input(' Enter seconds ');
    total=sec+min*60+hr*3600.;
    string=sprintf('\n total time = %10.4g sec',total);
    disp(string) 
end