< previous page page_203 next page >

Page 203
8.4.1
ISO Duration and
double
The functions in this section perform the interconversion of the ISO_DURATION structure and a type double value, which is a floating point representation of a period of time, not a Julian Day number. The floating point value can be treated as the difference between two Julian day numbers.
8.4.1.1
iso_duration_to_double ()
The routine iso_duration_to_double () (Listing 8.3) converts an elapsed time, combined as an ISO_DURATION structure, to a type double.
Listing 8.3 iso_duration_to_double ()
/* idur2dl.c


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


   Routine converts an elapsed time, combined as an ISO_DURATION
   structure, to a type double.


   INPUTS:
   1. duration, pointer to an ISO_DURATION structure containing the
      elapsed days as a DATE_INFO structure (standard year, standard
      month and day) and the elapsed time as a TIME_INFO structure
      (hours, minutes and seconds).


   OUTPUTS:
   1. Returned by routine, type double, assumed to be the difference
      between two Julian Day numbers.


   NOTES:
   1. This routine converts a duration of elapsed time into a difference
      between two Julian day numbers, expressed as a type double. To
      convert a date and time to its equivalent Julian Day number, use
      the ISO_DATE_TIME structure and the routine in this series,
      'iso_date_time_to_double ()'.


   2. Negative values of any units for either the 'date' or 'time'
      portions of the duration are inverted to produce a positive value,
      prior to use. No other validation is performed, and no warning is
      issued in this case.


   3. Note that the value returned by this routine is a difference
      between two Julian Day numbers. Specifically, the fractional
      portion of this value is NOT a displacement from 0.0 (noon),
      as is the case with the 'time_to_fraction ()' routine.
*/

 
< previous page page_203 next page >