mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'boost-date'
Fix a couple more bugs which manifest on Fedora.
This commit is contained in:
commit
d4c537a9a5
@ -562,33 +562,40 @@ TimeZoneProvider::TimeZoneProvider(const std::string& tzname) : zone_vector {}
|
|||||||
auto this_time = ptime(date(1970, 1, 1),
|
auto this_time = ptime(date(1970, 1, 1),
|
||||||
time_duration(txi->timestamp / 3600, 0,
|
time_duration(txi->timestamp / 3600, 0,
|
||||||
txi->timestamp % 3600));
|
txi->timestamp % 3600));
|
||||||
auto this_year = this_time.date().year();
|
try
|
||||||
//Initial case
|
|
||||||
if (last_time.is_not_a_date_time())
|
|
||||||
zone_vector.push_back(zone_no_dst(this_year - 1, last_info));
|
|
||||||
//gap in transitions > 1 year, non-dst zone
|
|
||||||
//change. In the last case the exact date of the change will be
|
|
||||||
//wrong because boost::local_date::timezone isn't able to
|
|
||||||
//represent it. For GnuCash's purposes this isn't likely to be
|
|
||||||
//important as the last time this sort of transition happened
|
|
||||||
//was 1946, but we have to handle the case in order to parse
|
|
||||||
//the tz file.
|
|
||||||
else if (this_year - last_time.date().year() > 1 ||
|
|
||||||
last_info->info.isdst == this_info->info.isdst)
|
|
||||||
{
|
{
|
||||||
zone_vector.push_back(zone_no_dst(this_year, last_info));
|
auto this_year = this_time.date().year();
|
||||||
}
|
//Initial case
|
||||||
|
if (last_time.is_not_a_date_time())
|
||||||
else
|
zone_vector.push_back(zone_no_dst(this_year - 1, last_info));
|
||||||
{
|
//gap in transitions > 1 year, non-dst zone
|
||||||
DSTRule::DSTRule new_rule(last_info, this_info,
|
//change. In the last case the exact date of the change will be
|
||||||
last_time, this_time);
|
//wrong because boost::local_date::timezone isn't able to
|
||||||
if (new_rule != last_rule)
|
//represent it. For GnuCash's purposes this isn't likely to be
|
||||||
|
//important as the last time this sort of transition happened
|
||||||
|
//was 1946, but we have to handle the case in order to parse
|
||||||
|
//the tz file.
|
||||||
|
else if (this_year - last_time.date().year() > 1 ||
|
||||||
|
last_info->info.isdst == this_info->info.isdst)
|
||||||
{
|
{
|
||||||
last_rule = new_rule;
|
zone_vector.push_back(zone_no_dst(this_year, last_info));
|
||||||
zone_vector.push_back(zone_from_rule (this_time.date().year(),
|
|
||||||
new_rule));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DSTRule::DSTRule new_rule(last_info, this_info,
|
||||||
|
last_time, this_time);
|
||||||
|
if (new_rule != last_rule)
|
||||||
|
{
|
||||||
|
last_rule = new_rule;
|
||||||
|
zone_vector.push_back(zone_from_rule (this_time.date().year(),
|
||||||
|
new_rule));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(boost::gregorian::bad_year err)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
last_time = this_time;
|
last_time = this_time;
|
||||||
last_info = this_info;
|
last_info = this_info;
|
||||||
|
@ -40,7 +40,8 @@ test_kvp_value_SOURCES = \
|
|||||||
test-kvp-frame.cpp
|
test-kvp-frame.cpp
|
||||||
test_kvp_value_LDADD = \
|
test_kvp_value_LDADD = \
|
||||||
$(top_builddir)/$(MODULEPATH)/libgnc-qof.la \
|
$(top_builddir)/$(MODULEPATH)/libgnc-qof.la \
|
||||||
$(GLIB_LIBS) \
|
$(GLIB_LIBS) \
|
||||||
|
$(GTEST_LIBS) \
|
||||||
$(BOOST_LDFLAGS)
|
$(BOOST_LDFLAGS)
|
||||||
|
|
||||||
if !GOOGLE_TEST_LIBS
|
if !GOOGLE_TEST_LIBS
|
||||||
@ -50,7 +51,7 @@ test_kvp_value_LDADD += $(top_builddir)/src/test-core/libgtest.a
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
test_kvp_value_CPPFLAGS = \
|
test_kvp_value_CPPFLAGS = \
|
||||||
-I$(GTEST_HEADERS) \
|
$(GTEST_HEADERS) \
|
||||||
-I$(top_srcdir)/$(MODULEPATH) \
|
-I$(top_srcdir)/$(MODULEPATH) \
|
||||||
$(GLIB_CFLAGS) \
|
$(GLIB_CFLAGS) \
|
||||||
$(BOOST_CPPFLAGS)
|
$(BOOST_CPPFLAGS)
|
||||||
@ -62,8 +63,7 @@ test_gnc_int128_SOURCES = \
|
|||||||
gtest-gnc-int128.cpp
|
gtest-gnc-int128.cpp
|
||||||
test_gnc_int128_CPPFLAGS = -I${GTEST_HEADERS}
|
test_gnc_int128_CPPFLAGS = -I${GTEST_HEADERS}
|
||||||
|
|
||||||
|
test_gnc_int128_LDADD = ${GTEST_LIBS}
|
||||||
test_gnc_int128_LDADD = $(GTEST_LIBS)
|
|
||||||
if !GOOGLE_TEST_LIBS
|
if !GOOGLE_TEST_LIBS
|
||||||
nodist_test_gnc_int128_SOURCES = \
|
nodist_test_gnc_int128_SOURCES = \
|
||||||
${GTEST_SRC}/src/gtest_main.cc
|
${GTEST_SRC}/src/gtest_main.cc
|
||||||
|
Loading…
Reference in New Issue
Block a user