< previous page page_201 next page >

Page 201
(continued)
Listing 8.1
struct ISO_DATE_TIME
{
   struct DATE_INFO date;
   struct TIME_INFO time;
};


/*
   The ISO_DURATION structure allows the ISO 8601 concept of a 'duration'
   to be implemented. Note that the structure of an ISO_DURATION is exactly
   the same as an ISO_DATE_TIME. The usage of the two structures is
   different, however. The ISO_DURATION structure carries the ISO 'standard'
   units which are used to measure elapsed time. These units are:


   1 minute = 60 seconds
   1 hour   = 60 minutes
   1 day    = 24 hours
   1 month  = 30 days
   1 year   = 12 months


   A year unit, therefore, consists of 360 standard days.
*/


struct ISO_DURATION
{
   struct DATE_INFO date;
   struct TIME_INFO time;
};


/*
   The ISO_PERIOD structure allows the ISO concept of 'period' to be expressed and
   carried. There are essentially three different kinds of period allowed in ISO usage:

   1. Missing 'begin' - 'duration' and 'end' expressed.
   2. Missing 'duration' - 'begin' and 'end' expressed.
   3. Missing 'end' - 'begin' and 'duration' expressed.


   The 'duration' unit is used as quantity of elapsed time, expressed
   using the standard ISO units, while 'begin' and 'end' are 'points'
   in time, conceived as combinations of date and time.


   Note that ISO usage therefore gives two different 'senses' to units such as
   'year'. In the sense of date/time, the year consists of 365.2422 days, a solar
   year. In the sense of duration, the year is a standard year of 360 days.


   Within the SCDTL system, the convention is adopted that all units of the
   ISO_PERIOD structure are assigned values by any function that generates such
   a structure. This convention ensures that all parts of an ISO_PERIOD are present
   and available for use at any time by any other function that uses it.


*/


struct ISO_PERIOD
{
   struct ISO_DATE_TIME begin;
   struct ISO_DURATION duration;
   struct ISO_DATE_TIME end;
};


#endif

 
< previous page page_201 next page >