Merge maint

This commit is contained in:
Geert Janssens
2019-08-17 12:53:55 +02:00
29 changed files with 26373 additions and 25745 deletions

View File

@@ -237,7 +237,7 @@ else()
set(BCRYPT "")
endif()
target_link_libraries(gncmod-engine gnc-core-utils gnc-module ${Boost_DATE_TIME_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${BCRYPT} ${REGEX_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GUILE_LDFLAGS})
target_link_libraries(gncmod-engine gnc-core-utils gnc-module ${Boost_DATE_TIME_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${ICU4C_I18N_LDFLAGS} ${BCRYPT} ${REGEX_LDFLAGS} ${GMODULE_LDFLAGS} ${GLIB2_LDFLAGS} ${GOBJECT_LDFLAGS} ${GUILE_LDFLAGS})
target_compile_definitions (gncmod-engine PRIVATE -DG_LOG_DOMAIN=\"gnc.engine\")

View File

@@ -48,6 +48,7 @@ extern "C"
}
#include <cinttypes>
#include <unicode/calendar.h>
#include "gnc-date.h"
#include "gnc-date-p.h"
@@ -201,6 +202,30 @@ gnc_gmtime (const time64 *secs)
}
gint
gnc_start_of_week (void)
{
/* icu's day of week is 1 based. Using 0 here to mean unset or error while setting */
static int cached_result = 0;
if (!cached_result)
{
UErrorCode err = U_ZERO_ERROR;
auto cal = icu::Calendar::createInstance (err);
if (!cal)
{
PERR("ICU error: %s\n", u_errorName (err));
return 0;
}
/* 1 for sunday, 2 for monday, etc. */
cached_result = cal->getFirstDayOfWeek (err);
delete cal;
}
return cached_result;
}
time64
gnc_mktime (struct tm* time)
{

View File

@@ -185,6 +185,11 @@ struct tm* gnc_localtime_r (const time64 *secs, struct tm* time);
*/
struct tm* gnc_gmtime (const time64 *secs);
/** \brief returns an integer corresponding to locale start of week
* \return An integer 1=Sunday, 2=Monday etc. If error, return 0.
*/
gint gnc_start_of_week (void);
/** \brief calculate seconds from the epoch given a time struct
* \param time: A struct tm* containing the date-time information.
* The time is understood to be in the current local time zone.

View File

@@ -99,6 +99,7 @@ set(gtest_qof_LIBS
${GOBJECT_LDFLAGS}
${GMODULE_LDFLAGS}
${GTHREAD_LDFLAGS}
${ICU4C_I18N_LDFLAGS}
${Boost_LIBRARIES}
${GTEST_LIB})
@@ -122,30 +123,26 @@ endif (WIN32)
set(test_gnc_guid_SOURCES
${MODULEPATH}/guid.cpp
test-gnc-guid.cpp
${GTEST_SRC})
test-gnc-guid.cpp)
gnc_add_test(test-gnc-guid "${test_gnc_guid_SOURCES}"
gtest_engine_INCLUDES gtest_old_engine_LIBS)
set(test_kvp_value_SOURCES
${MODULEPATH}/kvp-value.cpp
test-kvp-value.cpp
test-kvp-frame.cpp
${GTEST_SRC})
test-kvp-frame.cpp)
gnc_add_test(test-kvp-value "${test_kvp_value_SOURCES}"
gtest_engine_INCLUDES gtest_old_engine_LIBS)
set(test_qofsession_SOURCES
${MODULEPATH}/qofsession.cpp
test-qofsession.cpp
${GTEST_SRC})
test-qofsession.cpp)
gnc_add_test(test-qofsession "${test_qofsession_SOURCES}"
gtest_engine_INCLUDES gtest_old_engine_LIBS)
set(test_gnc_int128_SOURCES
${MODULEPATH}/gnc-int128.cpp
gtest-gnc-int128.cpp
${GTEST_SRC})
gtest-gnc-int128.cpp)
gnc_add_test(test-gnc-int128 "${test_gnc_int128_SOURCES}"
gtest_engine_INCLUDES gtest_qof_LIBS)
@@ -159,8 +156,7 @@ set(test_gnc_rational_SOURCES
${MODULEPATH}/qoflog.cpp
${CMAKE_SOURCE_DIR}/libgnucash/core-utils/gnc-locale-utils.cpp
${gtest_engine_win32_SOURCES}
gtest-gnc-rational.cpp
${GTEST_SRC})
gtest-gnc-rational.cpp)
gnc_add_test(test-gnc-rational "${test_gnc_rational_SOURCES}"
gtest_engine_INCLUDES gtest_qof_LIBS)
@@ -175,15 +171,13 @@ set(test_gnc_numeric_SOURCES
${MODULEPATH}/qoflog.cpp
${CMAKE_SOURCE_DIR}/libgnucash/core-utils/gnc-locale-utils.cpp
${gtest_engine_win32_SOURCES}
gtest-gnc-numeric.cpp
${GTEST_SRC})
gtest-gnc-numeric.cpp)
gnc_add_test(test-gnc-numeric "${test_gnc_numeric_SOURCES}"
gtest_engine_INCLUDES gtest_qof_LIBS)
set(test_gnc_timezone_SOURCES
${MODULEPATH}/gnc-timezone.cpp
gtest-gnc-timezone.cpp
${GTEST_SRC})
gtest-gnc-timezone.cpp)
gnc_add_test(test-gnc-timezone "${test_gnc_timezone_SOURCES}"
gtest_engine_INCLUDES gtest_old_engine_LIBS)
@@ -194,20 +188,17 @@ set(test_gnc_datetime_SOURCES
${MODULEPATH}/qoflog.cpp
${CMAKE_SOURCE_DIR}/libgnucash/core-utils/gnc-locale-utils.cpp
${gtest_engine_win32_SOURCES}
gtest-gnc-datetime.cpp
${GTEST_SRC})
gtest-gnc-datetime.cpp)
gnc_add_test(test-gnc-datetime "${test_gnc_datetime_SOURCES}"
gtest_engine_INCLUDES gtest_qof_LIBS)
set(test_import_map_SOURCES
gtest-import-map.cpp
${GTEST_SRC})
gtest-import-map.cpp)
gnc_add_test(test-import-map "${test_import_map_SOURCES}"
gtest_engine_INCLUDES gtest_old_engine_LIBS)
set(test_qofquerycore_SOURCES
gtest-qofquerycore.cpp
${GTEST_SRC})
gtest-qofquerycore.cpp)
gnc_add_test(test-qofquerycore "${test_qofquerycore_SOURCES}"
gtest_engine_INCLUDES gtest_old_engine_LIBS)