~ubuntu-branches/ubuntu/wily/deal.ii/wily-proposed

« back to all changes in this revision

Viewing changes to contrib/boost/include/boost/date_time/local_time_adjustor.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam C. Powell, IV, Adam C. Powell, IV, Denis Barbier
  • Date: 2010-07-29 13:47:01 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100729134701-qk60t2om7u7oklkb
Tags: 6.3.1-1
[ Adam C. Powell, IV ]
* Changed to source format 3.0 (quilt).
* Changed maintainer to debian-science with Adam Powell as uploader.
* Added source lintian overrides about Adam Powell's name.
* Added Vcs info on git repository.
* Bumped Standards-Version.
* Changed stamp-patch to patch target and fixed its application criterion.
* Moved make_dependencies and expand_instantiations to a versioned directory
  to avoid shlib package conflicts.

[ Denis Barbier ]
* New upstream release (closes: #562332).
  + Added libtbb support.
  + Forward-ported all patches.
* Updates for new PETSc version, including workaround for different versions
  of petsc and slepc.
* Add debian/watch.
* Update to debhelper 7.
* Added pdebuild patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * Boost Software License, Version 1.0. (See accompanying
7
7
 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
8
8
 * Author: Jeff Garland 
9
 
 * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
 
9
 * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
10
10
 */
11
11
 
12
12
/*! @file local_time_adjustor.hpp
13
13
  Time adjustment calculations for local times
14
14
*/
15
15
 
16
 
#include "boost/date_time/date_generators.hpp"
17
 
#include "boost/date_time/dst_rules.hpp"
18
16
#include <stdexcept>
 
17
#include <boost/throw_exception.hpp>
 
18
#include <boost/date_time/compiler_config.hpp>
 
19
#include <boost/date_time/date_generators.hpp>
 
20
#include <boost/date_time/dst_rules.hpp>
 
21
#include <boost/date_time/time_defs.hpp> // boost::date_time::dst_flags
 
22
#include <boost/date_time/special_defs.hpp> // not_a_date_time
19
23
 
20
24
namespace boost {
21
25
  namespace date_time {
109
113
        time_is_dst_result dst_flag = 
110
114
          dst_rules::local_is_dst(initial.date(), initial.time_of_day());
111
115
        switch(dst_flag) {
112
 
    case is_in_dst:        return utc_offset_rules::utc_to_local_base_offset() + dst_rules::dst_offset();
 
116
        case is_in_dst:        return utc_offset_rules::utc_to_local_base_offset() + dst_rules::dst_offset();
113
117
        case is_not_in_dst:    return utc_offset_rules::utc_to_local_base_offset();
114
118
        case invalid_time_label:return utc_offset_rules::utc_to_local_base_offset() + dst_rules::dst_offset();
115
119
        case ambiguous: {
125
129
          }
126
130
        }
127
131
        }//case
128
 
        //TODO  better excpetion type
129
 
        throw std::out_of_range("Unreachable case");
130
 
 
 
132
        //TODO  better exception type
 
133
        boost::throw_exception(std::out_of_range("Unreachable case"));
 
134
        BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return time_duration_type(not_a_date_time)); // should never reach
131
135
      }
132
136
 
133
137
      //! Get the offset to UTC given a local time
134
138
      static time_duration_type local_to_utc_offset(const time_type& t, 
135
139
                                                    date_time::dst_flags dst=date_time::calculate) 
136
 
      { 
 
140
      {
137
141
        switch (dst) {
138
142
        case is_dst:
139
143
          return utc_offset_rules::local_to_utc_base_offset() - dst_rules::dst_offset();
146
150
          case is_in_dst:      return utc_offset_rules::local_to_utc_base_offset() - dst_rules::dst_offset();
147
151
          case is_not_in_dst:      return utc_offset_rules::local_to_utc_base_offset();
148
152
          case ambiguous:          return utc_offset_rules::local_to_utc_base_offset();
149
 
          case invalid_time_label: throw std::out_of_range("Time label invalid");
 
153
          case invalid_time_label: break;
150
154
          }
151
 
        }  
152
 
        throw std::out_of_range("Time label invalid");
 
155
        }
 
156
        boost::throw_exception(std::out_of_range("Time label invalid"));
 
157
        BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return time_duration_type(not_a_date_time)); // should never reach
153
158
      }
154
159
 
155
 
    
 
160
 
156
161
    private:
157
162
 
158
163
    };