|
|
|
|
|
|
|
8.4.3.2 iso_begin_and_end_to_period () |
|
|
|
|
|
|
|
|
This routine (Listing 8.8) builds an ISO_PERIOD structure, using the begin and end date/times expressed as ISO_DATE_TIME structures. The duration is calculated from the begin and end date/times and inserted into the ISO_PERIOD structure. |
|
|
|
|
|
|
|
|
8.4.3.3 iso_duration_and_end_to_period () |
|
|
|
|
|
|
|
|
This routine (Listing 8.9) builds an ISO_PERIOD structure using the duration, expressed as an ISO_DURATION structure, and the end date/time, expressed as an ISO_DATE_TIME structure. The begin date/time is calculated from the duration and the end date/time and inserted into the ISO_PERIOD structure. |
|
|
|
|
| Listing 8.8 iso_begin_and_end_to_period () | |
|
|
|
|
/* ibe2per.c
+-------------------------------------------+
| Copyright (C) 1995 by Lance W. Latham. |
| All rights reserved. |
+-------------------------------------------+
Routine builds an ISO_PERIOD structure, using the begin and end
date/times, expressed as ISO_DATE_TIME structures. The duration
is calculated from the begin and end date/times, and inserted into
the ISO_PERIOD structure.
INPUTS:
1. begin, a pointer to an ISO_DATE_TIME structure containing
the 'begin' date/time for an ISO_PERIOD structure.
2. end, a pointer to an ISO_DATE_TIME structure containing the
'end' date/time for an ISO_PERIOD structure.
OUTPUTS:
1. Returned by routine, an ISO_PERIOD structure containing the
begin and end date/times and the duration calculated to exist
between them.
NOTES:
1. If the duration calculated between the two date/times is negative,
the 'begin' and 'end' dates are swapped in the ISO_PERIOD structure
which is output, and the duration is calculated from the positive
value obtained by inverting the sign of the calculated duration.
In other words, a negative duration is assumed to represent the situation
in which the 'end' date/time precedes the 'begin' date/time, so the two
are simply swapped, and the duration is calculated accordingly. No other
validation is performed, and no warning is issued in this case.
*/
|
|
|
|
|
|
|
|