< previous page page_208 next page >

Page 208
8.4.2.2
iso_double_to_date_time ()
The routine iso_double_to_date_time () (Listing 8.6) converts a type double to a date and time, combined as an ISO_DATE_TIME structure.
(continued)
Listing 8.5
#include "scdtl_2.h"
#include "iso_2.h"
double iso_date_time_to_double (struct ISO_DATE_TIME *dt)


{
   double jd;
   struct DATE_INFO date;
   struct TIME_INFO time;
   date = dt->date;
   time = dt->time;
   jd = date_and_time_to_JD (&date, &time);


   return (jd);
}

Listing 8.6 iso_double_to_date_time ()
/* idbl2dt.c


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


   Routine converts a type double to a date and time, combined as an
   ISO_DATE_TIME structure.


   INPUTS:
   1. jd, type double, assumed to be a Julian Day number. Valid values
      are greater than or equal to zero.


   OUTPUTS:
   1. Returned by routine, an ISO_DATE_TIME structure containing the date
      as a DATE_INFO structure (year, month and day) and the time as a
      TIME_INFO structure (hours, minutes and seconds).


   NOTES:
   1. The routine intercepts negative values of the input 'jd' and
      converts them to positive numbers by inverting the sign. No other
      validation is performed, and no warning is issued in this case.


   2. This routine converts a Julian Day number to its equivalent date
      and time. To convert a difference between two Julian day numbers,
      expressed as a type double, into a duration of elapsed time, use
      the ISO_DURATION structure and the routine 'iso_double_to_duration ()'.
*/

 
< previous page page_208 next page >