I want to convert a boost::posix_time::ptime to a boost::local_time::local_date_time using a timezone without daylight saving time only specified by it’s offset to UTC. I am using boost 1.47.0.
Currently I’m trying to create a boost::local_time::custom_time_zone (a.k.a custom_time_zone_base<char>). The only constructor of that class template is the follows:
custom_time_zone_base(
const time_zone_names& zone_names,
const time_duration_type& utc_offset,
const dst_adjustment_offsets& dst_shift,
boost::shared_ptr<dst_calc_rule> calc_rule);
What should I supply as the dst_shift and calc_rule arguments? Or is there another class that better suits my needs, as I’m also supplying a zone_names as a boost::local_time::time_zone_names initialized with 4 empty strings.
The example in the date time docs shows you how to create a custom time zone without DST. You can see it at http://www.boost.org/doc/libs/1_47_0/doc/html/date_time/examples.html#date_time.examples.simple_time_zone.
Look at the code for the phx_1 timezone. You basically pass in a dst_adjustment_offsets initialized to three copies of time_duration(0,0,0) (3rd parameter) and pass in an empty shared pointer for the calculation rules (4th parameter).
(From the examples:)