function [h, m, s] = to24hour(seconds)
%TO24HOUR Seconds after midnight to 24-hour clock time
%  [h, m, s] = to24hour(seconds) returns the hour h,
%  minute m, and second s on a 24-hour clock equal 
%  to the input number of seconds after midnight.
%
%  seconds is expected to be between 0 and 86399

% number of hours
h = floor(seconds / (60 * 60));
remaining = rem(seconds, (60 * 60));

% number of minutes
m = floor(remaining / 60);
remaining = rem(remaining, 60);

% number of seconds
s = remaining;

end
