mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-21 16:38:06 -06:00
Rename GncDateTime's ymd to gnc_ymd to avoid a name conflict with Carbon.
This commit is contained in:
parent
e92e7d0b2e
commit
fb9947b7b6
@ -318,7 +318,7 @@ public:
|
||||
GncDateImpl(const std::string str, const std::string fmt);
|
||||
|
||||
void today() { m_greg = boost::gregorian::day_clock::local_day(); }
|
||||
ymd year_month_day() const;
|
||||
gnc_ymd year_month_day() const;
|
||||
std::string format(const char* format) const;
|
||||
std::string format_zulu(const char* format) const {
|
||||
return this->format(format);
|
||||
@ -601,7 +601,7 @@ GncDateImpl::GncDateImpl(const std::string str, const std::string fmt) :
|
||||
std::stoi (what.str("DAY")));
|
||||
}
|
||||
|
||||
ymd
|
||||
gnc_ymd
|
||||
GncDateImpl::year_month_day() const
|
||||
{
|
||||
auto boost_ymd = m_greg.year_month_day();
|
||||
@ -738,7 +738,7 @@ GncDate::format(const char* format)
|
||||
return m_impl->format(format);
|
||||
}
|
||||
|
||||
ymd
|
||||
gnc_ymd
|
||||
GncDate::year_month_day() const
|
||||
{
|
||||
return m_impl->year_month_day();
|
||||
|
@ -35,7 +35,7 @@ typedef struct
|
||||
int year; //1400-9999
|
||||
int month; //1-12
|
||||
int day; //1-31
|
||||
} ymd;
|
||||
} gnc_ymd;
|
||||
|
||||
enum class DayPart {
|
||||
start, // 00:00 local
|
||||
@ -272,10 +272,10 @@ class GncDate
|
||||
GncDate& operator=(GncDate&&);
|
||||
/** Set the date object to the computer clock's current day. */
|
||||
void today();
|
||||
/** Get the year, month, and day from the date as a ymd.
|
||||
* @return ymd struct
|
||||
/** Get the year, month, and day from the date as a gnc_ymd.
|
||||
* @return gnc_ymd struct
|
||||
*/
|
||||
ymd year_month_day() const;
|
||||
gnc_ymd year_month_day() const;
|
||||
/** Format the GncDate into a std::string
|
||||
* @param format A cstr describing the way the date and time are
|
||||
* presented. Code letters preceded with % stand in for arguments;
|
||||
|
@ -340,7 +340,7 @@ TEST(gnc_datetime_constructors, test_struct_tm_constructor)
|
||||
|
||||
TEST(gnc_datetime_constructors, test_gncdate_start_constructor)
|
||||
{
|
||||
const ymd aymd = { 2017, 04, 20 };
|
||||
const gnc_ymd aymd = { 2017, 04, 20 };
|
||||
GncDateTime atime(GncDate(aymd.year, aymd.month, aymd.day), DayPart::start);
|
||||
//Skipping timezone information as this can't be controlled.
|
||||
EXPECT_EQ(atime.format("%d-%m-%Y %H:%M:%S"), "20-04-2017 00:00:00");
|
||||
@ -358,8 +358,8 @@ TEST(gnc_datetime_constructors, test_gncdate_start_constructor)
|
||||
*/
|
||||
TEST(gnc_datetime_constructors, test_gncdate_BST_transition)
|
||||
{
|
||||
const ymd begins = {2018, 03, 25};
|
||||
const ymd ends = {2018, 10, 28};
|
||||
const gnc_ymd begins = {2018, 03, 25};
|
||||
const gnc_ymd ends = {2018, 10, 28};
|
||||
#ifdef __MINGW32__
|
||||
TimeZoneProvider tzp{"GMT Standard Time"};
|
||||
#else
|
||||
@ -375,7 +375,7 @@ TEST(gnc_datetime_constructors, test_gncdate_BST_transition)
|
||||
|
||||
TEST(gnc_datetime_constructors, test_gncdate_end_constructor)
|
||||
{
|
||||
const ymd aymd = { 2046, 11, 06 };
|
||||
const gnc_ymd aymd = { 2046, 11, 06 };
|
||||
GncDateTime atime(GncDate(aymd.year, aymd.month, aymd.day), DayPart::end);
|
||||
//Skipping timezone information as this can't be controlled.
|
||||
EXPECT_EQ(atime.format("%d-%m-%Y %H:%M:%S"), "06-11-2046 23:59:59");
|
||||
@ -486,11 +486,11 @@ TEST(gnc_datetime_constructors, test_gncdate_neutral_constructor)
|
||||
TimeZoneProvider tzp_la("America/Los_Angeles");
|
||||
#endif
|
||||
_set_tzp(tzp_la);
|
||||
const ymd aymd = { 2017, 04, 20 };
|
||||
const gnc_ymd aymd = { 2017, 04, 20 };
|
||||
GncDateTime atime(GncDate(aymd.year, aymd.month, aymd.day), DayPart::neutral);
|
||||
time64 date{1492685940};
|
||||
GncDateTime gncdt(date); /* 20 Apr 2017 10:59:00 Z */
|
||||
/* The ymd constructor sets the time of day at 10:59:00 for
|
||||
/* The gnc_ymd constructor sets the time of day at 10:59:00 for
|
||||
* timezones between UTC-10 and UTC+13. For other timezones the
|
||||
* time of day is adjusted to ensure a consistent date and the
|
||||
* adjustment invalidates the test, so skip it.
|
||||
@ -509,8 +509,8 @@ TEST(gnc_datetime_constructors, test_gncdate_neutral_constructor)
|
||||
|
||||
TEST(gnc_datetime_constructors, test_neutral_across_timezones)
|
||||
{
|
||||
const ymd begins = {2018, 03, 05};
|
||||
const ymd ends = {2018, 03, 15};
|
||||
const gnc_ymd begins = {2018, 03, 05};
|
||||
const gnc_ymd ends = {2018, 03, 15};
|
||||
const time64 ten_days = 864000;
|
||||
#ifdef __MINGW32__
|
||||
TimeZoneProvider tzp_lon{"GMT Standard Time"};
|
||||
|
Loading…
Reference in New Issue
Block a user