Ниже приводится подробная ссылка на библиотеку date_time. Нажатие на любой из ссылок приведет вас к списку файлов заголовка, найденных в этом разделе. После одного из этих ссылок вы попадете в список элементов, заявленных в этом файле заголовка. Дополнительные подссылки приводят вас к подробным описаниям каждого отдельного элемента.
namespaceboost{namespaceCV{template<typename value_policies>classconstrained_value;template<typename rep_type,rep_type min_value,rep_type max_value,typename exception_type>classsimple_exception_policy;// Represent a min or max violation type. enumviolation_enum { min_violation, max_violation };}}
namespaceboost{namespacedate_time{std::stringconvert_to_lower(std::string);// Helper function for parse_date. template<typename month_type>unsignedshortmonth_str_to_ushort(std::stringconst& s);template<typename charT>shortfind_match(constcharT*const*,constcharT*const*,short,conststd::basic_string<charT>&);template<typename date_type>date_typeparse_date(conststd::string&,int=ymd_order_iso);// Generic function to parse undelimited date (eg: 20020201) template<typename date_type>date_typeparse_undelimited_date(conststd::string& s);template<typename date_type,typename iterator_type>date_typefrom_stream_type(iterator_type&,iterator_typeconst&,char);template<typename date_type,typename iterator_type>date_typefrom_stream_type(iterator_type&,iterator_typeconst&,std::stringconst&);template<typename date_type,typename iterator_type>date_typefrom_stream_type(iterator_type&,iterator_typeconst&,wchar_t);template<typename date_type,typename iterator_type>date_typefrom_stream_type(iterator_type&,iterator_typeconst&,std::wstringconst&);// function called by wrapper functions: date_period_from_(w)string() template<typename date_type,typename charT>period<date_type,typenamedate_type::duration_type>from_simple_string_type(conststd::basic_string<charT>& s);}}
Функция (функции) для преобразования между структурой FILETIME и объектом времени. Этот файл доступен только на системах, которые определили BOOST_HAS_FTIME.
Этот файл содержит реализацию абстракции периода. Это в основном та же идея, что и диапазон. Хотя этот класс предназначен для использования в библиотеке времени, он довольно близок к общему достаточному для других цифровых применений.
namespaceboost{namespacedate_time{// computes exponential math like 2^8 => 256, only works with positive integers template<typename int_type>int_typepower(int_type base,int_type exponent);template<typename time_duration,typename char_type>time_durationstr_from_delimited_time_duration(conststd::basic_string<char_type>&);template<typename time_duration>time_durationparse_delimited_time_duration(conststd::string&);// Utility function to split appart string. boolsplit(conststd::string& s,char sep,std::string& first,std::string& second);template<typename time_type>time_typeparse_delimited_time(conststd::string& s,char sep);// Parse time duration part of an iso time of form: [-]hhmmsstime_durationparse_undelimited_time_duration(conststd::string& s);// Parse time string of form YYYYMMDDThhmmss where T is delimeter between date and time. template<typename time_type>time_typeparse_iso_time(conststd::string& s,char sep);}}
namespaceboost{namespacegregorian{// Converts a date to a tm struct. Throws out_of_range exception if date is a special value. std::tmto_tm(constdate& d);// Converts a tm structure into a date dropping the any time values. datedate_from_tm(conststd::tm& datetm);}}
namespaceboost{namespacegregorian{template<typename charT>std::basic_string<charT>to_simple_string_type(constdate& d);template<typename charT>std::basic_string<charT>to_simple_string_type(constdate_period& d);template<typename charT>std::basic_string<charT>to_iso_string_type(constdate_period& d);template<typename charT>std::basic_string<charT>to_iso_extended_string_type(constdate& d);template<typename charT>std::basic_string<charT>to_iso_string_type(constdate& d);template<typename charT>std::basic_string<charT>to_sql_string_type(constdate& d);// Convert date period to simple string. Example: [2002-Jan-01/2002-Jan-02]. std::wstringto_simple_wstring(constdate_period& d);// To YYYY-mmm-DD string where mmm 3 char month name. Example: 2002-Jan-01. std::wstringto_simple_wstring(constdate& d);// Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231. std::wstringto_iso_wstring(constdate_period& d);// Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31. std::wstringto_iso_extended_wstring(constdate& d);// Convert to iso standard string YYYYMMDD. Example: 20021231. std::wstringto_iso_wstring(constdate& d);std::wstringto_sql_wstring(constdate& d);}}
namespaceboost{namespacegregorian{// To YYYY-mmm-DD string where mmm 3 char month name. Example: 2002-Jan-01. std::stringto_simple_string(constdate& d);// Convert date period to simple string. Example: [2002-Jan-01/2002-Jan-02]. std::stringto_simple_string(constdate_period& d);// Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231. std::stringto_iso_string(constdate_period& d);// Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31. std::stringto_iso_extended_string(constdate& d);// Convert to iso standard string YYYYMMDD. Example: 20021231. std::stringto_iso_string(constdate& d);std::stringto_sql_string(constdate& d);}}
namespaceboost{namespacegregorian{classgregorian_calendar;typedefdate_time::int_adapter<uint32_t>fancy_date_rep;// An internal date representation that includes infinities, not a date. }}
namespaceboost{namespacegregorian{structbad_day_of_month;classgreg_day;typedefCV::simple_exception_policy<unsignedshort,1,31,bad_day_of_month>greg_day_policies;// Policy class that declares error handling and day of month ranges. typedefCV::constrained_value<greg_day_policies>greg_day_rep;// Generated represetation for gregorian day of month. }}
namespaceboost{namespacegregorian{structbad_day_of_year;typedefCV::simple_exception_policy<unsignedshort,1,366,bad_day_of_year>greg_day_of_year_policies;// A day of the year range (1..366) typedefCV::constrained_value<greg_day_of_year_policies>greg_day_of_year_rep;// Define a range representation type for the day of the year 1..366. }}
namespaceboost{namespacegregorian{classdate_duration;typedefboost::date_time::duration_traits_adapteddate_duration_rep;// An internal date representation that includes infinities, not a date. typedefdate_durationdays;// Shorthand for date_duration. }}
namespaceboost{namespacegregorian{structgreg_facet_config;typedefboost::date_time::date_names_put<greg_facet_config>greg_base_facet;// Create the base facet type for gregorian::date. template<typename charT,typename traits>std::basic_ostream<charT,traits>&operator<<(std::basic_ostream<charT,traits>&,constdate&);template<typename charT,typename traits>std::basic_ostream<charT,traits>&operator<<(std::basic_ostream<charT,traits>&,constgreg_month&);template<typename charT,typename traits>std::basic_ostream<charT,traits>&operator<<(std::basic_ostream<charT,traits>&,constgreg_weekday&);template<typename charT,typename traits>std::basic_ostream<charT,traits>&operator<<(std::basic_ostream<charT,traits>&,constdate_period&);template<typename charT,typename traits>std::basic_ostream<charT,traits>&operator<<(std::basic_ostream<charT,traits>& os,constdate_duration& dd);// operator<< for gregorian::partial_date. Output: "Jan 1" template<typename charT,typename traits>std::basic_ostream<charT,traits>&operator<<(std::basic_ostream<charT,traits>& os,constpartial_date& pd);// operator<< for gregorian::nth_kday_of_month. Output: "first Mon of Jun" template<typename charT,typename traits>std::basic_ostream<charT,traits>&operator<<(std::basic_ostream<charT,traits>& os,constnth_kday_of_month& nkd);// operator<< for gregorian::first_kday_of_month. Output: "first Mon of Jun" template<typename charT,typename traits>std::basic_ostream<charT,traits>&operator<<(std::basic_ostream<charT,traits>& os,constfirst_kday_of_month& fkd);// operator<< for gregorian::last_kday_of_month. Output: "last Mon of Jun" template<typename charT,typename traits>std::basic_ostream<charT,traits>&operator<<(std::basic_ostream<charT,traits>& os,constlast_kday_of_month& lkd);// operator<< for gregorian::first_kday_after. Output: "first Mon after" template<typename charT,typename traits>std::basic_ostream<charT,traits>&operator<<(std::basic_ostream<charT,traits>& os,constfirst_kday_after& fka);// operator<< for gregorian::first_kday_before. Output: "first Mon before" template<typename charT,typename traits>std::basic_ostream<charT,traits>&operator<<(std::basic_ostream<charT,traits>& os,constfirst_kday_before& fkb);// operator>> for gregorian::datetemplate<typename charT>std::basic_istream<charT>&operator>>(std::basic_istream<charT>& is,date& d);// operator>> for gregorian::date_durationtemplate<typename charT>std::basic_istream<charT>&operator>>(std::basic_istream<charT>& is,date_duration& dd);// operator>> for gregorian::date_period template<typename charT>std::basic_istream<charT>&operator>>(std::basic_istream<charT>& is,date_period& dp);// generates a locale with the set of gregorian name-strings of type char* BOOST_DATE_TIME_DECLstd::localegenerate_locale(std::locale& loc,char type);// Returns a pointer to a facet with a default set of names (English) BOOST_DATE_TIME_DECLboost::date_time::all_date_names_put<greg_facet_config,char>*create_facet_def(char type);// generates a locale with the set of gregorian name-strings of type wchar_t* BOOST_DATE_TIME_DECLstd::localegenerate_locale(std::locale& loc,wchar_t type);// Returns a pointer to a facet with a default set of names (English) BOOST_DATE_TIME_DECLboost::date_time::all_date_names_put<greg_facet_config,wchar_t>*create_facet_def(wchar_t type);// operator>> for gregorian::greg_month - throws exception if invalid month given template<typename charT>std::basic_istream<charT>&operator>>(std::basic_istream<charT>& is,greg_month& m);// operator>> for gregorian::greg_weekday - throws exception if invalid weekday given template<typename charT>std::basic_istream<charT>&operator>>(std::basic_istream<charT>& is,greg_weekday& wd);}}
namespaceboost{namespacegregorian{structbad_month;classgreg_month;typedefdate_time::months_of_yearmonths_of_year;typedefCV::simple_exception_policy<unsignedshort,1,12,bad_month>greg_month_policies;// Build a policy class for the greg_month_rep. typedefCV::constrained_value<greg_month_policies>greg_month_rep;// A constrained range that implements the gregorian_month rules. }}
namespaceboost{namespacegregorian{structbad_year;classgreg_year;typedefCV::simple_exception_policy<unsignedshort,1400,10000,bad_year>greg_year_policies;// Policy class that declares error handling gregorian year type. typedefCV::constrained_value<greg_year_policies>greg_year_rep;// Generated representation for gregorian year. }}
Заголовок одного файла, который обеспечивает в целом, включает в себя все элементы григорианской системы времени. Это включает в себя различные типы, определенные, но и другие функции для форматирования и парирования.
Заголовок одного файла, который определяет большинство типов для григорианской системы времени.
namespaceboost{namespacegregorian{typedefdate_time::period<date,date_duration>date_period;// Date periods for the gregorian system. typedefdate_time::year_based_generator<date>year_based_generator;typedefdate_time::partial_date<date>partial_date;// A date generation object type. typedefdate_time::nth_kday_of_month<date>nth_kday_of_month;typedefnth_kday_of_monthnth_day_of_the_week_in_month;typedefdate_time::first_kday_of_month<date>first_kday_of_month;typedeffirst_kday_of_monthfirst_day_of_the_week_in_month;typedefdate_time::last_kday_of_month<date>last_kday_of_month;typedeflast_kday_of_monthlast_day_of_the_week_in_month;typedefdate_time::first_kday_after<date>first_kday_after;typedeffirst_kday_afterfirst_day_of_the_week_after;typedefdate_time::first_kday_before<date>first_kday_before;typedeffirst_kday_beforefirst_day_of_the_week_before;typedefdate_time::day_clock<date>day_clock;// A clock to get the current day from the local computer. typedefdate_time::date_itr_base<date>date_iterator;// Base date_iterator type for gregorian types. typedefdate_time::date_itr<date_time::day_functor<date>,date>day_iterator;// A day level iterator. typedefdate_time::date_itr<date_time::week_functor<date>,date>week_iterator;// A week level iterator. typedefdate_time::date_itr<date_time::month_functor<date>,date>month_iterator;// A month level iterator. typedefdate_time::date_itr<date_time::year_functor<date>,date>year_iterator;// A year level iterator. }}
namespaceboost{namespacegregorian{BOOST_DATE_TIME_DECLspecial_valuesspecial_value_from_string(conststd::string&);// Deprecated: Use from_simple_string. datefrom_string(std::string s);// From delimited date string where with order year-month-day eg: 2002-1-25 or 2003-Jan-25 (full month name is also accepted) datefrom_simple_string(std::string s);// From delimited date string where with order year-month-day eg: 1-25-2003 or Jan-25-2003 (full month name is also accepted) datefrom_us_string(std::string s);// From delimited date string where with order day-month-year eg: 25-1-2002 or 25-Jan-2003 (full month name is also accepted) datefrom_uk_string(std::string s);// From iso type date string where with order year-month-day eg: 20020125. datefrom_undelimited_string(std::string s);// From iso type date string where with order year-month-day eg: 20020125. datedate_from_iso_string(conststd::string& s);// Stream should hold a date in the form of: 2002-1-25. Month number, abbrev, or name are accepted. template<typename iterator_type>datefrom_stream(iterator_type beg,iterator_type end);// Function to parse a date_period from a string (eg: [2003-Oct-31/2003-Dec-25]) date_perioddate_period_from_string(conststd::string& s);// Function to parse a date_period from a wstring (eg: [2003-Oct-31/2003-Dec-25]) date_perioddate_period_from_wstring(conststd::wstring& s);}}
namespaceboost{namespaceposix_time{// Function that converts a time_t into a ptime. ptimefrom_time_t(std::time_t t);// Function that converts a ptime into a time_t. std::time_tto_time_t(ptime pt);// Convert a time to a tm structure truncating any fractional seconds. std::tmto_tm(constboost::posix_time::ptime& t);// Convert a time_duration to a tm structure truncating any fractional seconds and zeroing fields for date components. std::tmto_tm(constboost::posix_time::time_duration& td);// Convert a tm struct to a ptime ignoring is_dst flag. ptimeptime_from_tm(conststd::tm& timetm);template<typename TimeT,typename FileTimeT>TimeTfrom_ftime(constFileTimeT&);}}
Операторы для ptime и опциональных григорианских типов. Операторы используют до конца месяца поведение. Более подробную информацию об этом поведении можно найти в ссылке date_time/date_duration_types.hpp и документации для месячных и годичных итераторов.
namespaceboost{namespaceposix_time{classhours;classminutes;classseconds;typedefdate_time::subsecond_duration<time_duration,1000>millisec;// Allows expression of durations as milli seconds. typedefdate_time::subsecond_duration<time_duration,1000>milliseconds;typedefdate_time::subsecond_duration<time_duration,1000000>microsec;// Allows expression of durations as micro seconds. typedefdate_time::subsecond_duration<time_duration,1000000>microseconds;typedefdate_time::subsecond_duration<time_duration,1000000000>nanosec;// Allows expression of durations as nano seconds. typedefdate_time::subsecond_duration<time_duration,1000000000>nanoseconds;}}
namespaceboost{namespaceposix_time{typedefdate_time::time_itr<ptime>time_iterator;// Iterator over a defined time duration. typedefdate_time::second_clock<ptime>second_clock;// A time clock that has a resolution of one second. typedefdate_time::microsec_clock<ptime>microsec_clock;// A time clock that has a resolution of one microsecond. typedefdate_time::null_dst_rules<ptime::date_type,time_duration>no_dst;// Define a dst null dst rule for the posix_time system. typedefdate_time::us_dst_rules<ptime::date_type,time_duration>us_dst;// Define US dst rule calculator for the posix_time system. }}
namespaceboost{namespaceposix_time{template<typename charT>std::basic_string<charT>to_simple_string_type(time_duration td);// Time duration to string -hh::mm::ss.fffffff. Example: 10:09:03.0123456. std::stringto_simple_string(time_duration td);template<typename charT>std::basic_string<charT>to_iso_string_type(time_duration td);// Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456. std::stringto_iso_string(time_duration td);// Time to simple format CCYY-mmm-dd hh:mm:ss.fffffff. template<typename charT>std::basic_string<charT>to_simple_string_type(ptime t);// Time to simple format CCYY-mmm-dd hh:mm:ss.fffffff. std::stringto_simple_string(ptime t);template<typename charT>std::basic_string<charT>to_simple_string_type(time_period tp);// Convert to string of form [YYYY-mmm-DD HH:MM::SS.ffffff/YYYY-mmm-DD HH:MM::SS.fffffff]. std::stringto_simple_string(time_period tp);template<typename charT>std::basic_string<charT>to_iso_string_type(ptime t);// Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator. std::stringto_iso_string(ptime t);template<typename charT>std::basic_string<charT>to_iso_extended_string_type(ptime t);// Convert to form YYYY-MM-DDTHH:MM:SS where T is the date-time separator. std::stringto_iso_extended_string(ptime t);// Time duration to wstring -hh::mm::ss.fffffff. Example: 10:09:03.0123456. std::wstringto_simple_wstring(time_duration td);// Time duration in iso format -hhmmss,fffffff Example: 10:09:03,0123456. std::wstringto_iso_wstring(time_duration td);std::wstringto_simple_wstring(ptime t);// Convert to wstring of form [YYYY-mmm-DD HH:MM::SS.ffffff/YYYY-mmm-DD HH:MM::SS.fffffff]. std::wstringto_simple_wstring(time_period tp);// Convert iso short form YYYYMMDDTHHMMSS where T is the date-time separator. std::wstringto_iso_wstring(ptime t);// Convert to form YYYY-MM-DDTHH:MM:SS where T is the date-time separator. std::wstringto_iso_extended_wstring(ptime t);}}
Операторы для локальных_дат_времени и дополнительных григорианских типов. Операторы используют до конца месяца поведение. Более подробную информацию об этом поведении можно найти в ссылке date_time/date_duration_types.hpp и документации для месячных и годичных итераторов.
namespaceboost{namespacelocal_time{structpartial_date_rule_spec;structfirst_last_rule_spec;structlast_last_rule_spec;structnth_last_rule_spec;structnth_kday_rule_spec;typedefdate_time::dst_day_calc_rule<gregorian::date>dst_calc_rule;// Provides rule of the form starting Apr 30 ending Oct 21. typedefdate_time::day_calc_dst_rule<partial_date_rule_spec>partial_date_dst_rule;// Provides rule of the form first Sunday in April, last Saturday in Oct. typedefdate_time::day_calc_dst_rule<first_last_rule_spec>first_last_dst_rule;// Provides rule of the form first Sunday in April, last Saturday in Oct. typedefdate_time::day_calc_dst_rule<last_last_rule_spec>last_last_dst_rule;// Provides rule of the form last Sunday in April, last Saturday in Oct. typedefdate_time::day_calc_dst_rule<nth_last_rule_spec>nth_last_dst_rule;// Provides rule in form of [1st|2nd|3rd|4th] Sunday in April, last Sunday in Oct. typedefdate_time::day_calc_dst_rule<nth_kday_rule_spec>nth_kday_dst_rule;// Provides rule in form of [1st|2nd|3rd|4th] Sunday in April/October. typedefdate_time::day_calc_dst_rule<nth_kday_rule_spec>nth_day_of_the_week_in_month_dst_rule;// Provides rule in form of [1st|2nd|3rd|4th] Sunday in April/October. }}
namespaceboost{namespacelocal_time{typedefboost::date_time::period<local_date_time,boost::posix_time::time_duration>local_time_period;typedefdate_time::time_itr<local_date_time>local_time_iterator;typedefdate_time::second_clock<local_date_time>local_sec_clock;typedefdate_time::microsec_clock<local_date_time>local_microsec_clock;typedefdate_time::time_zone_base<posix_time::ptime,char>time_zone;typedefdate_time::time_zone_base<posix_time::ptime,wchar_t>wtime_zone;typedefboost::shared_ptr<time_zone>time_zone_ptr;// Shared Pointer for custom_time_zone and posix_time_zone objects. typedefboost::shared_ptr<wtime_zone>wtime_zone_ptr;typedefdate_time::time_zone_names_base<char>time_zone_names;typedefdate_time::time_zone_names_base<wchar_t>wtime_zone_names;}}
Статья Library Reference раздела The Boost C++ Libraries BoostBook Documentation Subset Chapter 10. Boost.Date_Time может быть полезна для разработчиков на c++ и boost.
Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.