Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::date_time::time_duration< T, rep_type > Class Template Reference

Represents some amount of elapsed time measure to a given resolution. More...

#include <time_duration.hpp>

Inheritance diagram for boost::date_time::time_duration< T, rep_type >:
Collaboration diagram for boost::date_time::time_duration< T, rep_type >:

Public Types

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
 

Public Member Functions

 time_duration ()
 
 time_duration (hour_type hours_in, min_type minutes_in, sec_type seconds_in=0, fractional_seconds_type frac_sec_in=0)
 
 time_duration (const time_duration< T, rep_type > &other)
 Construct from another time_duration (Copy constructor) More...
 
 time_duration (special_values sv)
 Construct from special_values. More...
 
hour_type hours () const
 Returns number of hours in the duration. More...
 
min_type minutes () const
 Returns normalized number of minutes. More...
 
sec_type seconds () const
 Returns normalized number of seconds (0..60) More...
 
sec_type total_seconds () const
 Returns total number of seconds truncating any fractional seconds. More...
 
tick_type total_milliseconds () const
 Returns total number of milliseconds truncating any fractional seconds. More...
 
tick_type total_nanoseconds () const
 Returns total number of nanoseconds truncating any sub millisecond values. More...
 
tick_type total_microseconds () const
 Returns total number of microseconds truncating any sub microsecond values. More...
 
fractional_seconds_type fractional_seconds () const
 Returns count of fractional seconds at given resolution. More...
 
duration_type invert_sign () const
 
bool is_negative () const
 
bool operator< (const time_duration &rhs) const
 
bool operator== (const time_duration &rhs) const
 
duration_type operator- () const
 unary- Allows for time_duration td = -td1 More...
 
duration_type operator- (const duration_type &d) const
 
duration_type operator+ (const duration_type &d) const
 
duration_type operator/ (int divisor) const
 
duration_type operator-= (const duration_type &d)
 
duration_type operator+= (const duration_type &d)
 
duration_type operator/= (int divisor)
 Division operations on a duration with an integer. More...
 
duration_type operator* (int rhs) const
 Multiplication operations an a duration with an integer. More...
 
duration_type operator*= (int divisor)
 
tick_type ticks () const
 
bool is_special () const
 Is ticks_ a special value? More...
 
bool is_pos_infinity () const
 Is duration pos-infinity. More...
 
bool is_neg_infinity () const
 Is duration neg-infinity. More...
 
bool is_not_a_date_time () const
 Is duration not-a-date-time. More...
 
impl_type get_rep () const
 Used for special_values output. More...
 

Static Public Member Functions

static duration_type unit ()
 Returns smallest representable duration. More...
 
static tick_type ticks_per_second ()
 Return the number of ticks in a second. More...
 
static time_resolutions resolution ()
 Provide the resolution of this duration type. More...
 
static unsigned short num_fractional_digits ()
 Returns number of possible digits in fractional seconds. More...
 

Protected Member Functions

 time_duration (impl_type in)
 

Protected Attributes

impl_type ticks_
 

Detailed Description

template<class T, typename rep_type>
class boost::date_time::time_duration< T, rep_type >

Represents some amount of elapsed time measure to a given resolution.

This class represents a standard set of capabilities for all counted time durations. Time duration implementations should derive from this class passing their type as the first template parameter. This design allows the subclass duration types to provide custom construction policies or other custom features not provided here.

Parameters
TThe subclass type
rep_typeThe time resolution traits for this duration type.

Member Typedef Documentation

template<class T, typename rep_type>
typedef rep_type::day_type boost::date_time::time_duration< T, rep_type >::day_type
template<class T, typename rep_type>
typedef T boost::date_time::time_duration< T, rep_type >::duration_type
template<class T, typename rep_type>
typedef rep_type::fractional_seconds_type boost::date_time::time_duration< T, rep_type >::fractional_seconds_type
template<class T, typename rep_type>
typedef rep_type::hour_type boost::date_time::time_duration< T, rep_type >::hour_type
template<class T, typename rep_type>
typedef rep_type::impl_type boost::date_time::time_duration< T, rep_type >::impl_type
template<class T, typename rep_type>
typedef rep_type::min_type boost::date_time::time_duration< T, rep_type >::min_type
template<class T, typename rep_type>
typedef rep_type::sec_type boost::date_time::time_duration< T, rep_type >::sec_type
template<class T, typename rep_type>
typedef rep_type::tick_type boost::date_time::time_duration< T, rep_type >::tick_type
template<class T, typename rep_type>
typedef rep_type boost::date_time::time_duration< T, rep_type >::traits_type

Constructor & Destructor Documentation

template<class T, typename rep_type>
boost::date_time::time_duration< T, rep_type >::time_duration ( )
inline
template<class T, typename rep_type>
boost::date_time::time_duration< T, rep_type >::time_duration ( hour_type  hours_in,
min_type  minutes_in,
sec_type  seconds_in = 0,
fractional_seconds_type  frac_sec_in = 0 
)
inline
template<class T, typename rep_type>
boost::date_time::time_duration< T, rep_type >::time_duration ( const time_duration< T, rep_type > &  other)
inline

Construct from another time_duration (Copy constructor)

template<class T, typename rep_type>
boost::date_time::time_duration< T, rep_type >::time_duration ( special_values  sv)
inline

Construct from special_values.

template<class T, typename rep_type>
boost::date_time::time_duration< T, rep_type >::time_duration ( impl_type  in)
inlineexplicitprotected

Member Function Documentation

template<class T, typename rep_type>
fractional_seconds_type boost::date_time::time_duration< T, rep_type >::fractional_seconds ( ) const
inline

Returns count of fractional seconds at given resolution.

Referenced by boost::serialization::save(), boost::posix_time::to_iso_string_type(), and boost::posix_time::to_simple_string_type().

template<class T, typename rep_type>
impl_type boost::date_time::time_duration< T, rep_type >::get_rep ( ) const
inline

Used for special_values output.

Referenced by boost::posix_time::to_iso_string_type(), and boost::posix_time::to_simple_string_type().

template<class T, typename rep_type>
bool boost::date_time::time_duration< T, rep_type >::is_neg_infinity ( ) const
inline

Is duration neg-infinity.

template<class T, typename rep_type>
bool boost::date_time::time_duration< T, rep_type >::is_negative ( ) const
inline
template<class T, typename rep_type>
bool boost::date_time::time_duration< T, rep_type >::is_not_a_date_time ( ) const
inline

Is duration not-a-date-time.

template<class T, typename rep_type>
bool boost::date_time::time_duration< T, rep_type >::is_pos_infinity ( ) const
inline

Is duration pos-infinity.

template<class T, typename rep_type>
static unsigned short boost::date_time::time_duration< T, rep_type >::num_fractional_digits ( )
inlinestatic

Returns number of possible digits in fractional seconds.

Referenced by boost::date_time::parse_undelimited_time_duration(), and boost::date_time::str_from_delimited_time_duration().

template<class T, typename rep_type>
duration_type boost::date_time::time_duration< T, rep_type >::operator* ( int  rhs) const
inline

Multiplication operations an a duration with an integer.

template<class T, typename rep_type>
duration_type boost::date_time::time_duration< T, rep_type >::operator*= ( int  divisor)
inline
template<class T, typename rep_type>
duration_type boost::date_time::time_duration< T, rep_type >::operator+ ( const duration_type d) const
inline
template<class T, typename rep_type>
duration_type boost::date_time::time_duration< T, rep_type >::operator+= ( const duration_type d)
inline
template<class T, typename rep_type>
duration_type boost::date_time::time_duration< T, rep_type >::operator- ( ) const
inline

unary- Allows for time_duration td = -td1

template<class T, typename rep_type>
duration_type boost::date_time::time_duration< T, rep_type >::operator- ( const duration_type d) const
inline
template<class T, typename rep_type>
duration_type boost::date_time::time_duration< T, rep_type >::operator-= ( const duration_type d)
inline
template<class T, typename rep_type>
duration_type boost::date_time::time_duration< T, rep_type >::operator/ ( int  divisor) const
inline
template<class T, typename rep_type>
duration_type boost::date_time::time_duration< T, rep_type >::operator/= ( int  divisor)
inline

Division operations on a duration with an integer.

template<class T, typename rep_type>
bool boost::date_time::time_duration< T, rep_type >::operator< ( const time_duration< T, rep_type > &  rhs) const
inline
template<class T, typename rep_type>
bool boost::date_time::time_duration< T, rep_type >::operator== ( const time_duration< T, rep_type > &  rhs) const
inline
template<class T, typename rep_type>
static time_resolutions boost::date_time::time_duration< T, rep_type >::resolution ( )
inlinestatic

Provide the resolution of this duration type.

template<class T, typename rep_type>
tick_type boost::date_time::time_duration< T, rep_type >::total_microseconds ( ) const
inline

Returns total number of microseconds truncating any sub microsecond values.

template<class T, typename rep_type>
tick_type boost::date_time::time_duration< T, rep_type >::total_milliseconds ( ) const
inline

Returns total number of milliseconds truncating any fractional seconds.

template<class T, typename rep_type>
tick_type boost::date_time::time_duration< T, rep_type >::total_nanoseconds ( ) const
inline

Returns total number of nanoseconds truncating any sub millisecond values.

Referenced by boost::interprocess::ipcdetail::ptime_to_timespec().

template<class T, typename rep_type>
sec_type boost::date_time::time_duration< T, rep_type >::total_seconds ( ) const
inline

Returns total number of seconds truncating any fractional seconds.

Referenced by boost::interprocess::ipcdetail::ptime_to_timespec(), and boost::sinks::file::rotation_at_time_interval::rotation_at_time_interval().

template<class T, typename rep_type>
static duration_type boost::date_time::time_duration< T, rep_type >::unit ( )
inlinestatic

Returns smallest representable duration.

Member Data Documentation

template<class T, typename rep_type>
impl_type boost::date_time::time_duration< T, rep_type >::ticks_
protected

The documentation for this class was generated from the following file: