// In header: <boost/date_time/time_facet.hpp>
template<typename time_type,typename CharT,typename OutItrT =std::ostreambuf_iterator<CharT,std::char_traits<CharT>>>classtime_facet:publicboost::date_time::date_facet<time_type::date_type,CharT,OutItrT>{public:// typestypedeftime_type::date_typedate_type;typedeftime_type::time_duration_typetime_duration_type;typedefboost::date_time::period<time_type,time_duration_type>period_type;typedefboost::date_time::date_facet<typenametime_type::date_type,CharT,OutItrT>base_type;typedefbase_type::string_typestring_type;typedefbase_type::char_typechar_type;typedef base_type::period_formatter_type period_formatter_type;typedef base_type::special_values_formatter_type special_values_formatter_type;typedef base_type::date_gen_formatter_type date_gen_formatter_type;// construct/copy/destructexplicittime_facet(::size_t=0);explicittime_facet(constchar_type*,period_formatter_type=period_formatter_type(),constspecial_values_formatter_type&=special_values_formatter_type(),date_gen_formatter_type=date_gen_formatter_type(),::size_t=0);// public member functionsstd::locale::id&__get_id(void)const;voidtime_duration_format(constchar_type*const);virtualvoidset_iso_format();virtualvoidset_iso_extended_format();OutItrTput(OutItrT,std::ios_base&,char_type,consttime_type&)const;OutItrTput(OutItrT,std::ios_base&,char_type,consttime_duration_type&)const;OutItrTput(OutItrT,std::ios_base&,char_type,constperiod_type&)const;// protected static functionsstaticstring_typefractional_seconds_as_string(consttime_duration_type&,bool);staticstring_typehours_as_string(consttime_duration_type&,int=2);template<typename IntT>staticstring_typeintegral_as_string(IntT,int=2);// public data membersstaticconstchar_type*fractional_seconds_format;staticconstchar_type*fractional_seconds_or_none_format;staticconstchar_type*seconds_with_fractional_seconds_format;staticconstchar_type*seconds_format;staticconstchar_type*hours_format;staticconstchar_type*unrestricted_hours_format;staticconstchar_type*standard_format;staticconstchar_type*zone_abbrev_format;staticconstchar_type*zone_name_format;staticconstchar_type*zone_iso_format;staticconstchar_type*zone_iso_extended_format;staticconstchar_type*posix_zone_string_format;staticconstchar_type*duration_seperator;staticconstchar_type*duration_sign_always;staticconstchar_type*duration_sign_negative_only;staticconstchar_type*negative_sign;staticconstchar_type*positive_sign;staticconstchar_type*iso_time_format_specifier;staticconstchar_type*iso_time_format_extended_specifier;staticconstchar_type*default_time_format;staticconstchar_type*default_time_duration_format;staticstd::locale::idid;};
Description
Facet используется для форматного вывода типов времени Этот класс предусматривает использование строк формата для вывода времени. В дополнение к флагам для форматирования элементов даты, следующие флаги разрешенного формата:
x X => формат по умолчанию - позволяет добавлять больше флагов по умолчанию (т.е. "%x%X%z")
f => дробные секунды ".123456"
F => дробные секунды или нет: как frac sec, но пустой, если frac sec == 0<1
s => секунды w/фракционные секунды "02.123" (это то же самое, что "%S%f) - %S => секунды "02" - %z => сокращенный часовой пояс "EDT" - %Z => полный часовой пояс название "Восточное дневное время"
time_facet
public
construct/copy/destruct
explicittime_facet(::size_t ref_arg =0);
sets default formats for ptime, local_date_time, and time_duration
Статья Class template time_facet раздела The Boost C++ Libraries BoostBook Documentation Subset Library Reference может быть полезна для разработчиков на c++ и boost.
Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.