[date_time] new local_date_time constuctor

Hi, This is a request to add a third constructor of the class boost::local_time::local_date_time. THE PROBLEM: The following piece of code throws an exception. date d(2008, Oct, 26); time_duration td( 2, 30, 0 ); // 2:30 a.m. time_zone_ptr tz( new posix_time_zone("CET-1CEST,M3.5.0,M10.5.0/3") ); local_date_time myLtime( d, td, tz, EXCEPTION_ON_ERROR ); // last line throws This is because the date and time I chose happens to be located in the "vulnerble" moment when the wall clock gets moved back by an hour. In human terms, time 2:30am appears twice on 26-Oct-2008 in CET time zone because at 3:00 am we go back to 2:00 am and arrive at point 2:30 once more. In terms of boost::date_time library, the following condition appears: (local_date_time::check_dst(d, td, tz) == ambiguous); I would like to be able to write something like "On creating date/time infer the DST flag; on ambiguity assume no DST". In fact I can do that currently by replacing the last line from my above example with: bool inDST = (local_date_time::check_dst(d, td, tz) == is_in_dst); local_date_time myLtime(d, td, tz, inDST); This has two drawbacks however. First, check_dst gets called twice: first by me, second by the constructor, to check it once more. Second, it is too (IMO) verbose. THE REQUEST: Would it be possible to add a third constructor of local_date_time class that would accept a hint how to solve an ambiguity (if we have one). It would read like: local_date_time myLtime( d, td, tz, ASSUME_NOT_DST_ON_ERROR ); In the boost code I found it was already thought of, but got into a TODO state. Is there any chance that it gets implemented? Regards, &rzej
participants (1)
-
a k