.ENTRY days-hours-minutes-seconds .TITLE Dealing with days, hours, minutes, and seconds .BODY Now we have reduced the problem to finding the normalized months, days, hours, minutes and seconds from a rest second counter <em>r</em> that is less than the number of seconds in a year. It would be natural to find the month next, but doing so would call for yet another <em>counting</em> process, because a month is an irregular time interval (some months have 31 days, others 30, February has normally 28 days, but there is 29 days in leap years).<p> It is easy to find the unnormalized number of days, and the normalized hours, minutes, and seconds from <em>r</em>. This is done by quotient and modulo <em>calculations</em>. The function {*how-many-days-hours-minutes-seconds} does that. We first find the (non day-normalized) number of days by dividing r by {seconds-in-a-day} (@a). The remainder, called {-n-rest-1} (@b) is used to find the hour-normalized number of hours by division of {-n-rest-1} by {seconds-in-an-hour} (@c). Again the remainder, {-n-rest-2} (@d) is found, and this quantum is used to find the minute-normalized number of minutes (@e). Finally the number of seconds are found in the last modulo calculation (@f). We use a sequential name-biding form {-let}* to find the results in a sequential fashion. Still we are entirely within the functional paradigm, of course. The function returns the list of days, hours, minutes, and seconds. .END

Generated: 21. Maj 2000, 15:06:48