summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-08-10 17:52:35 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-08-10 17:52:35 (GMT)
commitad83ce80cb21254fba2db6f626c65140fabd0145 (patch)
treeb03ad7c67a65f598a373766a2488e884943e614a /3rdParty
parent8e11206adcdff6f7781b4f12bac6eeb8c3cba65a (diff)
downloadswift-ad83ce80cb21254fba2db6f626c65140fabd0145.zip
swift-ad83ce80cb21254fba2db6f626c65140fabd0145.tar.bz2
Added boost/date_time/c_local_time_adjustor.hpp.
Diffstat (limited to '3rdParty')
-rw-r--r--3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp66
-rwxr-xr-x3rdParty/Boost/update.sh2
2 files changed, 68 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp b/3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp
new file mode 100644
index 0000000..f802582
--- /dev/null
+++ b/3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp
@@ -0,0 +1,66 @@
+#ifndef DATE_TIME_C_LOCAL_TIME_ADJUSTOR_HPP__
+#define DATE_TIME_C_LOCAL_TIME_ADJUSTOR_HPP__
+
+/* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc.
+ * Use, modification and distribution is subject to the
+ * Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+ * Author: Jeff Garland, Bart Garst
+ * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $
+ */
+
+/*! @file c_local_time_adjustor.hpp
+ Time adjustment calculations based on machine
+*/
+
+#include <stdexcept>
+#include <boost/throw_exception.hpp>
+#include <boost/date_time/compiler_config.hpp>
+#include <boost/date_time/c_time.hpp>
+
+namespace boost {
+namespace date_time {
+
+ //! Adjust to / from utc using the C API
+ /*! Warning!!! This class assumes that timezone settings of the
+ * machine are correct. This can be a very dangerous assumption.
+ */
+ template<class time_type>
+ class c_local_adjustor {
+ public:
+ typedef typename time_type::time_duration_type time_duration_type;
+ typedef typename time_type::date_type date_type;
+ typedef typename date_type::duration_type date_duration_type;
+ //! Convert a utc time to local time
+ static time_type utc_to_local(const time_type& t)
+ {
+ date_type time_t_start_day(1970,1,1);
+ time_type time_t_start_time(time_t_start_day,time_duration_type(0,0,0));
+ if (t < time_t_start_time) {
+ boost::throw_exception(std::out_of_range("Cannot convert dates prior to Jan 1, 1970"));
+ BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(return time_t_start_time); // should never reach
+ }
+ date_duration_type dd = t.date() - time_t_start_day;
+ time_duration_type td = t.time_of_day();
+ std::time_t t2 = dd.days()*86400 + td.hours()*3600 + td.minutes()*60 + td.seconds();
+ std::tm tms, *tms_ptr;
+ tms_ptr = c_time::localtime(&t2, &tms);
+ date_type d(static_cast<unsigned short>(tms_ptr->tm_year + 1900),
+ static_cast<unsigned short>(tms_ptr->tm_mon + 1),
+ static_cast<unsigned short>(tms_ptr->tm_mday));
+ time_duration_type td2(tms_ptr->tm_hour,
+ tms_ptr->tm_min,
+ tms_ptr->tm_sec,
+ t.time_of_day().fractional_seconds());
+
+ return time_type(d,td2);
+ }
+ };
+
+
+
+} } //namespace date_time
+
+
+
+#endif
diff --git a/3rdParty/Boost/update.sh b/3rdParty/Boost/update.sh
index 09eb7cb..28871fe 100755
--- a/3rdParty/Boost/update.sh
+++ b/3rdParty/Boost/update.sh
@@ -18,6 +18,8 @@ fi
cast.hpp \
date_time/posix_time/posix_time.hpp \
date_time/local_time/local_time.hpp \
+ date_time/c_local_time_adjustor.hpp \
+ date_time/gregorian/gregorian_types.hpp \
foreach.hpp \
filesystem.hpp \
filesystem/fstream.hpp \