![]() |
Home | Libraries | People | FAQ | More |
boost::date_time::static_local_time_adjustor — Embed the rules for local time adjustments at compile time.
// In header: <boost/date_time/local_time_adjustor.hpp> template<typename time_type, typename dst_rules, typename utc_offset_rules> class static_local_time_adjustor : public , public { public: // types typedef ; typedef ; // public static functions (const ); (const , = ); };
static_local_time_adjustor
public static functions(const t);Calculates the offset from a utc time to local based on dst and utc offset.
The logic is as follows. Starting with UTC time use the offset to create a label for an non-dst adjusted local time. Then call dst_rules::local_is_dst with the non adjust local time. The results of this function will either unabiguously decide that the initial local time is in dst or return an illegal or ambiguous result. An illegal result only occurs at the end of dst (where labels are skipped) and indicates that dst has ended. An ambiguous result means that we need to recheck by making a dst adjustment and then rechecking. If the dst offset is added to the utc time and the recheck proves non-ambiguous then we are past the boundary. If it is still ambiguous then we are ahead of the boundary and dst is still in effect.
TODO – check if all dst offsets are positive. If not then the algorithm needs to check for this and reverse the illegal/ambiguous logic.
Parameters: |
|
(const t, dst = );Get the offset to UTC given a local time.