ProteoWizard
Functions
boost::date_time Namespace Reference

Functions

template<class time_type >
time_type time_from_OADATE (double oa_date)
 Create a time object from an OLE automation date value.

Function Documentation

template<class time_type >
time_type boost::date_time::time_from_OADATE ( double  oa_date)
inline

Create a time object from an OLE automation date value.

Create a time object from an OLE automation date value. An OLE automation date is implemented as a floating-point number * whose value is the number of days from midnight, 30 December 1899.

Definition at line 51 of file DateTime.hpp.

{
typedef typename time_type::date_type date_type;
typedef typename time_type::date_duration_type date_duration_type;
typedef typename time_type::time_duration_type time_duration_type;
using boost::math::modf;
static const date_type base_date(1899, Dec, 30);
static const time_type base_time(base_date, time_duration_type(0,0,0));
int dayOffset, hourOffset, minuteOffset, secondOffset;
double fraction = fabs(modf(oa_date, &dayOffset)) * 24; // fraction = hours
fraction = modf(fraction, &hourOffset) * 60; // fraction = minutes
fraction = modf(fraction, &minuteOffset) * 60; // fraction = seconds
modf(fraction, &secondOffset);
time_type t(base_time);
t += time_duration_type(hourOffset, minuteOffset, secondOffset);
t += date_duration_type(dayOffset);
return t;
}