Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template local_date_time_base

boost::local_time::local_date_time_base — Representation of "wall-clock" time in a particular time zone.

Synopsis

// In header: <boost/date_time/local_time/local_date_time.hpp>

template<typename utc_time_, 
         typename tz_type> 
class local_date_time_base : public  {
public:
  // types
  typedef                          ;     
  typedef  ;
  typedef           ;         
  typedef           ;
  typedef    ;  

  enum DST_CALC_OPTIONS { EXCEPTION_ON_ERROR, NOT_DATE_TIME_ON_ERROR };

  // construct/copy/destruct
  (, );
  (, , 
                       , );
  (, , 
                       , );
  (local_date_time_base &);
  (, 
                                 = );
  ~();

  // public member functions
   () ;
   () ;
   () ;
   () ;
   () ;
  local_date_time_base 
  (,  = ) ;
   ( = ) ;
   ( = ) ;
   () ;
   (local_date_time_base &) ;
   (local_date_time_base &) ;
   (local_date_time_base &) ;
   (local_date_time_base &) ;
   (local_date_time_base &) ;
   (local_date_time_base &) ;
  local_date_time_base () ;
  local_date_time_base ();
  local_date_time_base () ;
  local_date_time_base ();
  local_date_time_base () ;
  local_date_time_base ();
  local_date_time_base () ;
  local_date_time_base ();
   (local_date_time_base &) ;

  // public static functions
   
  (, , );

  // private member functions
   
  (, , );
   (, ) ;
};

Description

Representation of "wall-clock" time in a particular time zone Local_date_time_base holds a time value (date and time offset from 00:00) along with a time zone. The time value is stored as UTC and conversions to wall clock time are made as needed. This approach allows for operations between wall-clock times in different time zones, and daylight savings time considerations, to be made. Time zones are required to be in the form of a boost::shared_ptr<time_zone_base>.

local_date_time_base public construct/copy/destruct

  1. ( t,  tz);

    This constructor interprets the passed time as a UTC time. So, for example, if the passed timezone is UTC-5 then the time will be adjusted back 5 hours. The time zone allows for automatic calculation of whether the particular time is adjusted for daylight savings, etc. If the time zone shared pointer is null then time stays unadjusted.

    Parameters:

    t

    A UTC time

    tz

    Timezone for to adjust the UTC time to.

  2. ( d,  td, 
                          tz,  dst_flag);

    This constructs a local time – the passed time information understood to be in the passed tz. The DST flag must be passed to indicate whether the time is in daylight savings or not.

    Throws:

    -- time_label_invalid if the time passed does not exist in the given locale. The non-existent case occurs typically during the shift-back from daylight savings time. When the clock is shifted forward a range of times (2 am to 3 am in the US) is skipped and hence is invalid. dst_not_valid if the DST flag is passed for a period where DST is not active.
  3. ( d,  td, 
                          tz, 
                          calc_option);

    This constructs a local time – the passed time information understood to be in the passed tz. The DST flag is calculated according to the specified rule.

  4. (local_date_time_base & rhs);
    Copy constructor.
  5. ( sv, 
                                   tz = );
    Special values constructor.
  6. ~();
    Simple destructor, releases time zone if last referrer.

local_date_time_base public member functions

  1.  () ;
    returns time zone associated with calling instance
  2.  () ;
    returns false is time_zone is NULL and if time value is a special_value
  3.  () ;
    Returns object's time value as a utc representation.
  4.  () ;
    Returns object's time value as a local representation.
  5.  () ;
    Returns string in the form "2003-Aug-20 05:00:00 EDT".

    Returns string in the form "2003-Aug-20 05:00:00 EDT". If time_zone is NULL the time zone abbreviation will be "UTC". The time zone abbrev will not be included if calling object is a special_value

  6. local_date_time_base 
    ( new_tz,  td = ) ;

    returns a local_date_time_base in the given time zone with the optional time_duration added.

  7.  ( as_offset = ) ;
    Returns name of associated time zone or "Coordinated Universal Time".

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

  8.  ( as_offset = ) ;
    Returns abbreviation of associated time zone or "UTC".

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

  9.  () ;
    returns a posix_time_zone string for the associated time_zone. If no time_zone, "UTC+00" is returned.
  10.  (local_date_time_base & rhs) ;
    Equality comparison operator.

    Equality comparison operator

  11.  (local_date_time_base & rhs) ;
    Non-Equality comparison operator.
  12.  (local_date_time_base & rhs) ;
    Less than comparison operator.
  13.  (local_date_time_base & rhs) ;
    Less than or equal to comparison operator.
  14.  (local_date_time_base & rhs) ;
    Greater than comparison operator.
  15.  (local_date_time_base & rhs) ;
    Greater than or equal to comparison operator.
  16. local_date_time_base ( dd) ;
    Local_date_time + date_duration.
  17. local_date_time_base ( dd);
    Local_date_time += date_duration.
  18. local_date_time_base ( dd) ;
    Local_date_time - date_duration.
  19. local_date_time_base ( dd);
    Local_date_time -= date_duration.
  20. local_date_time_base ( td) ;
    Local_date_time + time_duration.
  21. local_date_time_base ( td);
    Local_date_time += time_duration.
  22. local_date_time_base ( td) ;
    Local_date_time - time_duration.
  23. local_date_time_base ( td);
    Local_date_time -= time_duration.
  24.  (local_date_time_base & rhs) ;
    local_date_time -= local_date_time --> time_duration_type

local_date_time_base public static functions

  1.  
    ( d,  td,  tz);
    Determines if given time label is in daylight savings for given zone.

    Determines if given time label is in daylight savings for given zone. Takes a date and time_duration representing a local time, along with time zone, and returns a time_is_dst_result object as result.

local_date_time_base private member functions

  1.  
    ( t,  z, 
                             dst_flag);

    Adjust the passed in time to UTC?

  2.  ( td, 
                                separator) ;

    Simple formatting code – todo remove this?


PrevUpHomeNext