Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Class template time_duration

Boost , The Boost C++ Libraries BoostBook Documentation Subset , Library Reference

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Class template time_duration

boost::date_time::time_duration — Represents some amount of elapsed time measure to a given resolution.

Synopsis

// In header: <boost/date_time/time_duration.hpp>
template<typename T, typename rep_type> 
class time_duration :
  private boost::less_than_comparable< T, boost::equality_comparable< T > >
{
public:
  // types
  typedef void                              _is_boost_date_time_duration;
  typedef T                                 duration_type;               
  typedef rep_type                          traits_type;                 
  typedef rep_type::day_type                day_type;                    
  typedef rep_type::hour_type               hour_type;                   
  typedef rep_type::min_type                min_type;                    
  typedef rep_type::sec_type                sec_type;                    
  typedef rep_type::fractional_seconds_type fractional_seconds_type;     
  typedef rep_type::tick_type               tick_type;                   
  typedef rep_type::impl_type               impl_type;                   
  // construct/copy/destruct
  time_duration();
  time_duration(hour_type, min_type, sec_type = 0, 
                fractional_seconds_type = 0);
  time_duration(const time_duration< T, rep_type > &);
  time_duration(special_values);
  explicit time_duration(impl_type);
  // public member functions
  hour_type hours() const;
  min_type minutes() const;
  sec_type seconds() const;
  sec_type total_seconds() const;
  tick_type total_milliseconds() const;
  tick_type total_nanoseconds() const;
  tick_type total_microseconds() const;
  fractional_seconds_type fractional_seconds() const;
  duration_type invert_sign() const;
  bool is_negative() const;
  bool operator<(const time_duration &) const;
  bool operator==(const time_duration &) const;
  duration_type operator-() const;
  duration_type operator-(const duration_type &) const;
  duration_type operator+(const duration_type &) const;
  duration_type operator/(int) const;
  duration_type operator-=(const duration_type &);
  duration_type operator+=(const duration_type &);
  duration_type operator/=(int);
  duration_type operator*(int) const;
  duration_type operator*=(int);
  tick_type ticks() const;
  bool is_special() const;
  bool is_pos_infinity() const;
  bool is_neg_infinity() const;
  bool is_not_a_date_time() const;
  impl_type get_rep() const;
  // public static functions
  static duration_type unit();
  static tick_type ticks_per_second();
  static time_resolutions resolution();
  static unsigned short num_fractional_digits();
};

Description

Этот класс представляет собой стандартный набор возможностей для всех отсчитанных длительностей времени. Реализации длительности времени должны происходить из этого класса, передающего свой тип в качестве первого параметра шаблона. Эта конструкция позволяет типам длительности подкласса предоставлять пользовательские политики строительства или другие пользовательские функции, не предусмотренные здесь.

time_duration public construct/copy/destruct

  1. <
    time_duration();
    >
  2. <
    time_duration(hour_typehours_in,min_typeminutes_in,
                 sec_typeseconds_in=0,
                 fractional_seconds_typefrac_sec_in=0);
    >
  3. <
    time_duration(consttime_duration<T,rep_type>&other);
    >Построение из другого<time_duration>(Конструктор копий)
  4. time_duration(special_valuessv);
    Построение из специальных значений.
  5. <
    explicittime_duration(impl_typein);
    >

time_duration public member functions

  1. <
    hour_typehours()const;
    >Возвращает количество часов.
  2. min_typeminutes()const;
    Возвращает нормальное количество минут.
  3. sec_typeseconds()const;
    Возвращает нормализованное количество секунд (0..60)
  4. <
    sec_typetotal_seconds()const;
    >Возвращает общее количество секунд, сокращая любые дробные секунды.
  5. <
    tick_typetotal_milliseconds()const;
    >Возвращает общее количество миллисекунд, усекающих любые дробные секунды.
  6. tick_typetotal_nanoseconds()const;
    Возвращает общее количество наносекунд, усеченных любыми значениями субмиллисекунд.
  7. tick_typetotal_microseconds()const;
    Возвращает общее количество микросекунд, усеченных любыми значениями субмикросекунд.
  8. <
    fractional_seconds_typefractional_seconds()const;
    >Возвращает счет дробных секунд при данном разрешении.
  9. <
    duration_typeinvert_sign()const;
    >
  10. <
    boolis_negative()const;
    >
  11. <
    booloperator<(consttime_duration&rhs)const;
    >
  12. <
    booloperator==(consttime_duration&rhs)const;
    >
  13. duration_typeoperator-()const;
    unary — позволяетtime_durationtd = -td1
  14. <
    duration_typeoperator-(constduration_type&d)const;
    >
  15. <
    duration_typeoperator+(constduration_type&d)const;
    >
  16. <
    duration_typeoperator/(intdivisor)const;
    >
  17. <
    duration_typeoperator-=(constduration_type&d);
    >
  18. <
    duration_typeoperator+=(constduration_type&d);
    >
  19. duration_typeoperator/=(intdivisor);
    Операции дивизиона по длительности с целым числом.
  20. <
    duration_typeoperator*(intrhs)const;
    >Операции умножения длительностью с целым числом.
  21. <
    duration_typeoperator*=(intdivisor);
    >
  22. <
    tick_typeticks()const;
    >
  23. <
    boolis_special()const;
    >Являются ли клещи особой ценностью?
  24. boolis_pos_infinity()const;
    Это бесконечность.
  25. boolis_neg_infinity()const;
    Продолжительность равна нулю.
  26. <
    boolis_not_a_date_time()const;
    >Продолжительность не является датой.
  27. <
    impl_typeget_rep()const;
    >Используется для вывода специальных значений.

time_duration public static functions

  1. <
    staticduration_typeunit();
    >Возврат наименьшей репрезентативной продолжительности.
  2. <
    statictick_typeticks_per_second();
    >Возвращайте количество клещей в секунду.
  3. <
    statictime_resolutionsresolution();
    >Предоставьте разрешение этого типа продолжительности.
  4. staticunsignedshortnum_fractional_digits();
    Возвращает число возможных цифр в дробные секунды.

PrevUpHomeNext

Статья Class template time_duration раздела The Boost C++ Libraries BoostBook Documentation Subset Library Reference может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Library Reference ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-05-20 01:25:17/0.0046358108520508/0