gnucash master: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Sat Dec 26 14:55:06 EST 2015
Updated via https://github.com/Gnucash/gnucash/commit/e0495fe2 (commit)
via https://github.com/Gnucash/gnucash/commit/e5ad4aad (commit)
from https://github.com/Gnucash/gnucash/commit/e4d3e900 (commit)
commit e0495fe269b34a68326b471a55b0a578d93f8196
Author: John Ralls <jralls at ceridwen.us>
Date: Sat Dec 26 11:42:38 2015 -0800
Fully identify the boost header that needs to be fixed for C++11 compilation.
diff --git a/configure.ac b/configure.ac
index 4e897c0..a27c310 100644
--- a/configure.ac
+++ b/configure.ac
@@ -229,7 +229,11 @@ zone_no_dst(int year, TZInfo *std_info)
])],
[AC_MSG_RESULT([yes])],
- [AC_MSG_FAILURE([Boost Header Fails to compile with C++11. To fix this, open it and change line 67 to
+ [AC_MSG_FAILURE([
+Boost Header Fails to compile with C++11. To fix this, open
+date_time/local_time/custom_time_zone.hpp, perhaps as root,
+in your boost include directory (/usr/include/boost in most cases)
+and change line 67 to
return (bool) dst_calc_rules_; //if calc_rule is set the tz has dst
])])
CXXFLAGS="$oldcxxflags"
commit e5ad4aad2d745ec4aa49e295d35e66229f4a190e
Author: John Ralls <jralls at ceridwen.us>
Date: Tue Dec 15 13:38:50 2015 -0800
Remove libboost_date_time dependency from libgnc-qof.
Changing the way the GncDateTimeImpl string constructor works allows
boost date_time to be used headers-only, which simplifies linkage.
diff --git a/src/libqof/qof/Makefile.am b/src/libqof/qof/Makefile.am
index 8d23077..17f62d0 100644
--- a/src/libqof/qof/Makefile.am
+++ b/src/libqof/qof/Makefile.am
@@ -11,7 +11,6 @@ libgnc_qof_la_LDFLAGS= \
libgnc_qof_common_libs = \
$(GLIB_LIBS) \
$(REGEX_LIBS) \
- $(BOOST_LDFLAGS) -lboost_date_time \
$(top_builddir)/lib/libc/libc-missing.la
libgnc_qof_la_LIBADD = $(libgnc_qof_common_libs)
diff --git a/src/libqof/qof/gnc-datetime.cpp b/src/libqof/qof/gnc-datetime.cpp
index db8215a..9f9535f 100644
--- a/src/libqof/qof/gnc-datetime.cpp
+++ b/src/libqof/qof/gnc-datetime.cpp
@@ -28,7 +28,10 @@ extern "C"
#include "platform.h"
}
#include <boost/date_time/gregorian/gregorian.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
#include <memory>
+#include <iostream>
+#include <sstream>
#include "gnc-timezone.hpp"
#include "gnc-datetime.hpp"
@@ -38,6 +41,7 @@ using PTime = boost::posix_time::ptime;
using LDT = boost::local_time::local_date_time;
using Duration = boost::posix_time::time_duration;
using LDTBase = boost::local_time::local_date_time_base<PTime, boost::date_time::time_zone_base<PTime, char>>;
+using boost::date_time::special_values::not_a_date_time;
using time64 = int64_t;
static const TimeZoneProvider tzp;
@@ -171,7 +175,15 @@ GncDateTimeImpl::GncDateTimeImpl(const std::string str) :
}
try
{
- auto pdt = boost::posix_time::time_from_string(str.substr(0, tzpos));
+ using Facet = boost::posix_time::time_input_facet;
+ //The stream destructor frees the facet, so it must be heap-allocated.
+ auto input_facet(new Facet());
+ std::istringstream ss(str.substr(0, tzpos));
+ ss.imbue(std::locale(std::locale(), input_facet));
+ input_facet->set_iso_extended_format();
+ PTime pdt(not_a_date_time);
+ ss >> pdt;
+ std::cout << std::endl << "String " << ss.str() << " produced " << pdt << std::endl;
m_time = LDT(pdt.date(), pdt.time_of_day(), tzptr,
LDTBase::NOT_DATE_TIME_ON_ERROR);
}
diff --git a/src/libqof/qof/test/test-gnc-date.c b/src/libqof/qof/test/test-gnc-date.c
index d62f352..9841d6f 100644
--- a/src/libqof/qof/test/test-gnc-date.c
+++ b/src/libqof/qof/test/test-gnc-date.c
@@ -1623,7 +1623,7 @@ test_gnc_iso8601_to_timespec_gmt (FixtureA *f, gconstpointer pData)
#else
g_assert_cmpint (t.tv_nsec, ==, f->ts1.tv_nsec);
#endif
- t = gnc_iso8601_to_timespec_gmt ("2020-11-7 06:21:19 -05");
+ t = gnc_iso8601_to_timespec_gmt ("2020-11-07 06:21:19 -05");
g_assert_cmpint (t.tv_sec, ==, f->ts2.tv_sec);
g_assert_cmpint (t.tv_nsec, ==, f->ts2.tv_nsec);
Summary of changes:
configure.ac | 6 +++++-
src/libqof/qof/Makefile.am | 1 -
src/libqof/qof/gnc-datetime.cpp | 14 +++++++++++++-
src/libqof/qof/test/test-gnc-date.c | 2 +-
4 files changed, 19 insertions(+), 4 deletions(-)
More information about the gnucash-changes
mailing list