date
gregorian_calendar_base
gregorian_calendar:是date的模板类型参数calendar的一个实现
gregorian_calendar_base:ymd_type表示日历年月日的表示类型,需要是算术类型,date_int_type_是日期计数类型,也必须是算术类型
ymd_type的基础模板类为year_month_day_base
greg_year_month_day:是格林威治年月日类型,是year_month_day_base的模板实例类
greg_year_month_day 的类依赖关系
greg_year_rep:是constrained_value的模板实例类,类型为greg_year_policies
greg_month_rep:是constrained_value的模板实例类,类型为greg_month_policies
greg_day_rep :是constrained_value的模板实例类,类型为greg_day_policies
greg_day_policies:是simple_exception_policy的模板实例类,类型为unsigned short, 1, 31, bad_day_of_month
greg_month_policies:是simple_exception_policy的模板实例类,类型为unsigned short, 1, 12, bad_month
greg_year_policies:是simple_exception_policy的模板实例类,类型为unsigned short, 1400, 10000, bad_year
gregorian_calendar_base模板参数date_int_type_是在int_adapter中定义的类型,也是int_adapter的模板参数
int_adapter其支持正无穷大,负无穷大,以及非值
int_adapter中定义的类型有
typedef int_type_ int_type;
date_duration
date_duration中定义了两个类型,其是模板类型参数duration_rep_traits中定义的
typedef typename duration_rep_traits::int_type duration_rep_type
typedef typename duration_rep_traits::impl_type duration_rep;
date_duration依赖的模板类型参数duration_rep_traits,有两个实现类型,
一个是duration_traits_long,另外一个是duration_traits_adapted。
duration_traits_long和duration_traits_adapted的int_type是long,duration_traits_long的impl_type是long,duration_traits_adapted的impl_type是int_adapter
years_duration和months_duration的模板类型参数base_config,在gregorian的类型实例为greg_durations_config
weeks_duration:用来表示有相隔多少个7天
months_duration:用来表示相隔多少个月
years_duration:用来表示相隔多少个年
period
用来表示日期区间,是左闭右开区间。
period:设计成模板,支持point_rep为年,月,日,周等,duration_rep为对应的区间类型
period_formatter:其模板成员方法put_period会依赖于period和date_facet类型,其默认格式为[date1/date2]或者[date1/date2),闭区间形式和左闭右开区间形式
迭代器
其中date_itr_base的get_offset和get_neg_offset为抽象方法
date_itr中的offset_functor 可能为day_functor,month_functor,week_functor或者year_functor中的一种
date_facet
为日期类型提供基于 I/O 方面的格式
date_facet内部的类型定义
typedef typename date_type::duration_type duration_type;
// greg_weekday is gregorian_calendar::day_of_week_type
typedef typename date_type::day_of_week_type day_of_week_type;
typedef typename date_type::day_type day_type;
typedef typename date_type::month_type month_type;
typedef boost::date_time::period<date_type,duration_type> period_type;
typedef std::basic_string<CharT> string_type;
typedef CharT char_type;
typedef boost::date_time::period_formatter<CharT> period_formatter_type;
typedef boost::date_time::special_values_formatter<CharT> special_values_formatter_type;
typedef std::vector<std::basic_string<CharT> > input_collection_type;
// used for the output of the date_generators
typedef date_generator_formatter<date_type, CharT> date_gen_formatter_type;
typedef partial_date<date_type> partial_date_type;
typedef nth_kday_of_month<date_type> nth_kday_type;
typedef first_kday_of_month<date_type> first_kday_type;
typedef last_kday_of_month<date_type> last_kday_type;
typedef first_kday_after<date_type> kday_after_type;
typedef first_kday_before<date_type> kday_before_type;
date_input_facet内部的类型定义
typedef typename date_type::duration_type duration_type;
// greg_weekday is gregorian_calendar::day_of_week_type
typedef typename date_type::day_of_week_type day_of_week_type;
typedef typename date_type::day_type day_type;
typedef typename date_type::month_type month_type;
typedef typename date_type::year_type year_type;
typedef boost::date_time::period<date_type,duration_type> period_type;
typedef std::basic_string<CharT> string_type;
typedef CharT char_type;
typedef boost::date_time::period_parser<date_type, CharT> period_parser_type;
typedef boost::date_time::special_values_parser<date_type,CharT> special_values_parser_type;
typedef std::vector<std::basic_string<CharT> > input_collection_type;
typedef format_date_parser<date_type, CharT> format_date_parser_type;
// date_generators stuff goes here
typedef date_generator_parser<date_type, CharT> date_gen_parser_type;
typedef partial_date<date_type> partial_date_type;
typedef nth_kday_of_month<date_type> nth_kday_type;
typedef first_kday_of_month<date_type> first_kday_type;
typedef last_kday_of_month<date_type> last_kday_type;
typedef first_kday_after<date_type> kday_after_type;
typedef first_kday_before<date_type> kday_before_type;
gregorian
date
date_duration
gregorian_calendar
time
microsec_clock
微秒时钟,依赖于模板参数time_type
time_duration
time_resolution_traits
frac_sec_type:表示时间分辨就率特点类型
res:是时间分辨率枚举类型,支持的有
enum time_resolutions {
sec,
tenth,
hundreth, // deprecated misspelled version of hundredth
hundredth = hundreth,
milli,
ten_thousandth,
micro,
nano,
NumResolutions
};
resolution_adjust:是frac_sec_type中定义的int_type类型
posix_time使用的是
typedef date_time::time_resolution_traits<
boost::date_time::time_resolution_traits_adapted64_impl, boost::date_time::micro,
1000000, 6 > time_res_traits
工具
ctime
提供将time_t转为tm,也支持多线程
值约束以及策略
其中min_value和max_value表示类型为rep_type的最小值,最大值
day_clock
提供天级别的时间服务,基于time_t,转为tm