dst_transition_day_rules.hpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef LOCAL_TIME_DST_TRANSITION_DAY_RULES_HPP__
  2. #define LOCAL_TIME_DST_TRANSITION_DAY_RULES_HPP__
  3. /* Copyright (c) 2003-2004 CrystalClear Software, Inc.
  4. * Subject to the Boost Software License, Version 1.0.
  5. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
  6. * Author: Jeff Garland, Bart Garst
  7. * $Date$
  8. */
  9. #include "boost/date_time/gregorian/gregorian_types.hpp"
  10. #include "boost/date_time/dst_transition_generators.hpp"
  11. namespace boost {
  12. namespace local_time {
  13. //! Provides rule of the form starting Apr 30 ending Oct 21
  14. typedef date_time::dst_day_calc_rule<gregorian::date> dst_calc_rule;
  15. struct partial_date_rule_spec
  16. {
  17. typedef gregorian::date date_type;
  18. typedef gregorian::partial_date start_rule;
  19. typedef gregorian::partial_date end_rule;
  20. };
  21. //! Provides rule of the form first Sunday in April, last Saturday in Oct
  22. typedef date_time::day_calc_dst_rule<partial_date_rule_spec> partial_date_dst_rule;
  23. struct first_last_rule_spec
  24. {
  25. typedef gregorian::date date_type;
  26. typedef gregorian::first_kday_of_month start_rule;
  27. typedef gregorian::last_kday_of_month end_rule;
  28. };
  29. //! Provides rule of the form first Sunday in April, last Saturday in Oct
  30. typedef date_time::day_calc_dst_rule<first_last_rule_spec> first_last_dst_rule;
  31. struct last_last_rule_spec
  32. {
  33. typedef gregorian::date date_type;
  34. typedef gregorian::last_kday_of_month start_rule;
  35. typedef gregorian::last_kday_of_month end_rule;
  36. };
  37. //! Provides rule of the form last Sunday in April, last Saturday in Oct
  38. typedef date_time::day_calc_dst_rule<last_last_rule_spec> last_last_dst_rule;
  39. struct nth_last_rule_spec
  40. {
  41. typedef gregorian::date date_type;
  42. typedef gregorian::nth_kday_of_month start_rule;
  43. typedef gregorian::last_kday_of_month end_rule;
  44. };
  45. //! Provides rule in form of [1st|2nd|3rd|4th] Sunday in April, last Sunday in Oct
  46. typedef date_time::day_calc_dst_rule<nth_last_rule_spec> nth_last_dst_rule;
  47. struct nth_kday_rule_spec
  48. {
  49. typedef gregorian::date date_type;
  50. typedef gregorian::nth_kday_of_month start_rule;
  51. typedef gregorian::nth_kday_of_month end_rule;
  52. };
  53. //! Provides rule in form of [1st|2nd|3rd|4th] Sunday in April/October
  54. typedef date_time::day_calc_dst_rule<nth_kday_rule_spec> nth_kday_dst_rule;
  55. //! Provides rule in form of [1st|2nd|3rd|4th] Sunday in April/October
  56. typedef date_time::day_calc_dst_rule<nth_kday_rule_spec> nth_day_of_the_week_in_month_dst_rule;
  57. } }//namespace
  58. #endif