function[timestring] = tstring(jsec,fs,timei)
% tstring returns a string that lists day, hours, minutes and secs
%    of an event indexed by array index
%   [timestring] = tstring(jsec,fs,timei)
%  Inputs:  
%   jsec: time in secs 
%           since begining of year at beginning of file
%   fs sampling frequency
%   timei:  index where we want the time string
%
ysec = jsec + timei/fs;
[day,hour,min,sec,msec] = stodhms(ysec);

sprintf('%d',hour);
if (hour < 10)
    hourstring = ['0' ans];
else hourstring = ans;
end
sprintf('%d',min);
if (min < 10)
    minstring = ['0' ans];
else minstring = ans;
end
sprintf('%d',sec);
if (sec < 10)
    secstring = ['0' ans];
else secstring = ans;
end
ss = [hourstring 'h' minstring 'm' secstring 's'];
%sprintf('%dd%dh%dm%ds',day,hour,min,sec);
sprintf('%dd%s',day,ss);
timestring=ans;
