src/License/nemesis_lic/license.hpp
// ----------------------------------------------------------------------
// Convert time_T to boost date.
// ----------------------------------------------------------------------
Convert time_T to boost date.
Convert time_T to boost date .
inline
boost::gregorian::date from_time_t(cube2_time_t64 t)
{
   We know that internally the library can handle larger
   "durations", it is just that the construction routines do not
   allow you to create them.
	cube2_time_t64 num_longs = t / std::numeric_limits<boost::int32_t>::max();
	long remainder = t % std::numeric_limits<boost::int32_t>::max();
  boost::posix_time::time_duration duration(boost::posix_time::seconds(0));
  for (cube2_time_t64 j = 0; j < num_longs; ++j) {
	  duration = duration + boost::posix_time::seconds(std::numeric_limits<boost::int32_t>::max());
  }
  duration = duration + boost::posix_time::seconds(remainder);
  boost::posix_time::ptime retval(boost::gregorian::date(1970,1,1), duration);
  return retval.date();
}
inline boost :: gregorian :: date from_time_t ( cube2_time_t64 t ) { cube2_time_t64 num_longs = t / std :: numeric_limits < boost :: int32_t > :: max ( ) ; long remainder = t % std :: numeric_limits < boost :: int32_t > :: max ( ) ; boost :: posix_time :: time_duration duration ( boost :: posix_time :: seconds ( 0 ) ) ; for ( cube2_time_t64 j = 0 ; j < num_longs ; ++ j ) { duration = duration + boost :: posix_time :: seconds ( std :: numeric_limits < boost :: int32_t > :: max ( ) ) ; } duration = duration + boost :: posix_time :: seconds ( remainder ) ; boost :: posix_time :: ptime retval ( boost :: gregorian :: date ( 1970 , 1 , 1 ) , duration ) ; return retval . date ( ) ; }
Convert time_T to boost date.
Convert time_T to boost date .
// The boost::posix_time::time_duration construction routines that // take number of seconds all take a long (32-bits) as input.  Here // we expect some durations to be larger than can be fit in a long, // so we add a little at a time. // // We know that internally the library can handle larger // "durations", it is just that the construction routines do not // allow you to create them.