Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2005-11-28 07:32:55


On Mon, 28 Nov 2005 08:31:11 +0200, Roman Yakovenko wrote
> Good morning. I think I found small bug, but I am not sure.
> ( boost version is 1.33.1 beta )
>
> Description:
>
> [micro]second_clock< boost::local_time::local_date_time_base<> >
> could not be compiled. The problematic function is: private: static
> time_type create_time(::std::tm* current);
>
> The error is that local_date_time_base<> does not have constructors
> that takes date and time duration.

It's not really a problem. With local_time you need to provide a timezone
pointer to get a time value. So you call it like this:
  //get time in new york time zone:
  boost::shared_ptr<time_zone> ny_tz(new
posix_time_zone("EST-05EDT,M4.1.0,M10.5.0"));

  local_date_time ldt3 = local_microsec_clock::local_time(ny_tz);

You'll note that there is another overloading in clock classes for this case:

  template<class time_zone_type>
  static time_type local_time(shared_ptr<time_zone_type> tz_ptr);

If you want no adjustment from the machine, pass an empty shared ptr.

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk