function [day,hour,min,sec,msec] = stodhms(ysec)
%CONVERTS time in a "seconds from year onset" format into
%"day, hour, minute, second, millisecond" format.

day=ysec/86400;
day=floor(day);
hour=(ysec-day*86400)/3600;
hour=floor(hour);
min=(ysec-(day*86400+hour*3600))/60;
min=floor(min);
sec=ysec-(day*86400+hour*3600+min*60);
sec=floor(sec);
msec=(ysec-(day*86400+hour*3600+min*60+sec))/.001;