...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::date_time::dst_calculator — Dynamic class used to caluclate dst transition information.
// In header: <boost/date_time/dst_rules.hpp> template<typename date_type_, typename time_duration_type_> class dst_calculator { public: // types typedef time_duration_type_ time_duration_type; typedef date_type_ date_type; // public static functions static time_is_dst_result process_local_dst_start_day(const time_duration_type &, unsigned int, long); static time_is_dst_result process_local_dst_end_day(const time_duration_type &, unsigned int, long); static time_is_dst_result local_is_dst(const date_type &, const time_duration_type &, const date_type &, const time_duration_type &, const date_type &, const time_duration_type &, const time_duration_type &); static time_is_dst_result local_is_dst(const date_type &, const time_duration_type &, const date_type &, unsigned int, const date_type &, unsigned int, long); };
dst_calculator
public static functionsstatic time_is_dst_result process_local_dst_start_day(const time_duration_type & time_of_day, unsigned int dst_start_offset_minutes, long dst_length_minutes);Check the local time offset when on dst start day.
On this dst transition, the time label between the transition boundary and the boudary + the offset are invalid times. If before the boundary then still not in dst.
Parameters: |
|
static time_is_dst_result process_local_dst_end_day(const time_duration_type & time_of_day, unsigned int dst_end_offset_minutes, long dst_length_minutes);Check the local time offset when on the last day of dst.
This is the calculation for the DST end day. On that day times prior to the conversion time - dst_length (1 am in US) are still in dst. Times between the above and the switch time are ambiguous. Times after the start_offset are not in dst.
Parameters: |
|
static time_is_dst_result local_is_dst(const date_type & current_day, const time_duration_type & time_of_day, const date_type & dst_start_day, const time_duration_type & dst_start_offset, const date_type & dst_end_day, const time_duration_type & dst_end_offset, const time_duration_type & dst_length_minutes);Calculates if the given local time is dst or not.
Determines if the time is really in DST or not. Also checks for invalid and ambiguous.
Parameters: |
|
static time_is_dst_result local_is_dst(const date_type & current_day, const time_duration_type & time_of_day, const date_type & dst_start_day, unsigned int dst_start_offset_minutes, const date_type & dst_end_day, unsigned int dst_end_offset_minutes, long dst_length_minutes);Calculates if the given local time is dst or not.
Determines if the time is really in DST or not. Also checks for invalid and ambiguous.
Parameters: |
|