function [ d, h, m, s ] = r8_days_to_dhms ( days )

%*****************************************************************************80
%
%% R8_DAYS_TO_DHMS converts decimal days into days, hours, minutes, seconds.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license. 
%
%  Modified:
%
%    31 July 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real DAYS, a decimal number representing a time 
%    period measured in days.
%
%    Output, integer D, integer H, integer M, real S, the equivalent number 
%    of days, hours, minutes and seconds.
%
  days_sign = r8_sign ( days );
  days = abs ( days );

  d = floor ( days );

  days = days - d;
  days = 24.0 * days;
  h = floor ( days );

  days = days - h;
  days = 60.0 * days;
  m = floor ( days );

  days = days - m;
  days = 60.0 * days;
  s = days;

  d = days_sign * d;
  h = days_sign * h;
  m = days_sign * m;
  s = days_sign * s;

  return
end

