Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template base_time

boost::date_time::base_time — Representation of a precise moment in time, including the date.

Synopsis

// In header: <boost/date_time/time.hpp>

template<typename T, typename time_system> 
class base_time : private  {
public:
  // types
  typedef                             ;
  typedef                                ;                     
  typedef       ;                 
  typedef           ;                     
  typedef  ;            
  typedef  ;            

  // construct/copy/destruct
  (, ,  = );
  ();
  ();

  // public member functions
   () ;
   () ;
   ( = ) ;
   ( = ) ;
   () ;
   () ;
   () ;
   () ;
   () ;
   () ;
   () ;
   () ;
   () ;
   () ;
   ();
   () ;
   ();
   () ;
   ();
   () ;
   ();
};

Description

This class is a skeleton for the interface of a temporal type with a resolution that is higher than a day. It is intended that this class be the base class and that the actual time class be derived using the BN pattern. In this way, the derived class can make decisions such as 'should there be a default constructor' and what should it set its value to, should there be optional constructors say allowing only an time_durations that generate a time from a clock,etc. So, in fact multiple time types can be created for a time_system with different construction policies, and all of them can perform basic operations by only writing a copy constructor. Finally, compiler errors are also shorter.

The real behavior of the time class is provided by the time_system template parameter. This class must provide all the logic for addition, subtraction, as well as define all the interface types.

base_time public construct/copy/destruct

  1. ( day,  td, 
               dst = );
  2. ( sv);
  3. ( rhs);

base_time public member functions

  1.  () ;
  2.  () ;
  3.  ( = ) ;

    Optional bool parameter will return time zone as an offset (ie "+07:00"). Empty string is returned for classes that do not use a time_zone

  4.  ( = ) ;

    Optional bool parameter will return time zone as an offset (ie "+07:00"). Empty string is returned for classes that do not use a time_zone

  5.  () ;
    An empty string is returned for classes that do not use a time_zone.
  6.  () ;
    check to see if date is not a value
  7.  () ;
    check to see if date is one of the infinity values
  8.  () ;
    check to see if date is greater than all possible dates
  9.  () ;
    check to see if date is greater than all possible dates
  10.  () ;
    check to see if time is a special value
  11.  ( rhs) ;
    Equality operator – others generated by boost::equality_comparable.
  12.  ( rhs) ;
    Equality operator – others generated by boost::less_than_comparable.
  13.  
    ( rhs) ;
    difference between two times
  14.  ( dd) ;
    add date durations
  15.  ( dd);
  16.  ( dd) ;
    subtract date durations
  17.  ( dd);
  18.  ( td) ;
    add time durations
  19.  ( td);
  20.  
    ( rhs) ;
    subtract time durations
  21.  ( td);

PrevUpHomeNext