< previous page page_85 next page >

Page 85
The SCDTL perspective on the 12-hour clock, therefore, is to provide only the necessary functions to allow an application to display time in this format [format_time_12 ()] and convert time to and from this format (this section), but otherwise use the 24-hour clock as the standard form of representation. You may have noticed, for example, that no make function is provided for the TIME_12 structure in section 5.1.1, although this function is trivial to write.
Listing 5.1 make_date()
/* makedate.c


   +-------------------------------------------+
   |   Copyright (C) 1995 by Lance W. Latham.  |
   |         All rights reserved.              |
   +-------------------------------------------+


   Builds a DATE_INFO structure from integer inputs.


   INPUTS:
   1. year, type int, assumed to be a complete year (i.e., '1992', not '92').
   2. month, type int, 1  12
   3. day, type int, 1  31


   OUTPUTS
   1. Returned by routine, a DATE_INFO structure, representing the input
      date.


   NOTES:
   1. This routine can be used for testing functions which use DATE_INFO
      inputs, as well as building dates after data entry and validation.


   2. This routine does not validate the inputs.
*/


#include "scdtl_1.h"


struct DATE_INFO make-date (int year, int month, int day)
{
   struct DATE_INFO d;


   d.day = day;
   d.month = month;
   d.year = year;


   return (d);
}

 
< previous page page_85 next page >