mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-26 02:40:43 -06:00
Some gcc don't like having a struct ymd and a ymd() member function.
This commit is contained in:
parent
f87f9ca02d
commit
9fbc447f74
@ -1400,7 +1400,7 @@ GDate* gnc_g_date_new_today ()
|
||||
{
|
||||
GncDate gncd;
|
||||
gncd.today();
|
||||
auto ymd = gncd.ymd();
|
||||
auto ymd = gncd.year_month_day();
|
||||
auto month = static_cast<GDateMonth>(ymd.month);
|
||||
auto result = g_date_new_dmy (ymd.day, month, ymd.year);
|
||||
g_assert(g_date_valid (result));
|
||||
|
@ -64,13 +64,13 @@ public:
|
||||
GncDateImpl(Date d) : m_greg(d) {}
|
||||
|
||||
void today() { m_greg = boost::gregorian::day_clock::local_day(); }
|
||||
ymd ymd() const;
|
||||
ymd year_month_day() const;
|
||||
private:
|
||||
Date m_greg;
|
||||
};
|
||||
|
||||
ymd
|
||||
GncDateImpl::ymd() const
|
||||
GncDateImpl::year_month_day() const
|
||||
{
|
||||
auto boost_ymd = m_greg.year_month_day();
|
||||
return {boost_ymd.year, boost_ymd.month.as_number(), boost_ymd.day};
|
||||
@ -229,9 +229,9 @@ GncDate::today()
|
||||
}
|
||||
|
||||
ymd
|
||||
GncDate::ymd() const
|
||||
GncDate::year_month_day() const
|
||||
{
|
||||
return m_impl->ymd();
|
||||
return m_impl->year_month_day();
|
||||
}
|
||||
|
||||
GncDateTime::GncDateTime() : m_impl(new GncDateTimeImpl) {}
|
||||
|
@ -68,7 +68,7 @@ public:/** Construct a GncDate representing the current day.
|
||||
/** Get the year, month, and day from the date as a ymd.
|
||||
@return ymd struct
|
||||
*/
|
||||
ymd ymd() const;
|
||||
ymd year_month_day() const;
|
||||
/** Test that the Date has an implementation. */
|
||||
bool isnull (void) { return m_impl == nullptr; }
|
||||
|
||||
|
@ -77,12 +77,12 @@ TEST(gnc_datetime_functions, test_format)
|
||||
EXPECT_EQ(atime.format("%d-%m-%Y"), "13-11-2045");
|
||||
}
|
||||
|
||||
//This is a bit convoluted because it uses GncDate's GncDateImpl constructor and ymd() function. There's no good way to test the former without violating the privacy of the implementation.
|
||||
//This is a bit convoluted because it uses GncDate's GncDateImpl constructor and year_month_day() function. There's no good way to test the former without violating the privacy of the implementation.
|
||||
TEST(gnc_datetime_functions, test_date)
|
||||
{
|
||||
GncDateTime atime(2394187200); //2045-11-13 12:00:00 Z
|
||||
GncDate gncd = std::move(atime.date());
|
||||
auto ymd = gncd.ymd();
|
||||
auto ymd = gncd.year_month_day();
|
||||
EXPECT_EQ(ymd.year, 2045);
|
||||
EXPECT_EQ(ymd.month, 11);
|
||||
EXPECT_EQ(ymd.day, 13);
|
||||
|
Loading…
Reference in New Issue
Block a user