Skip to content

Commit

Permalink
Reuse method for high-resolution dates
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Jul 29, 2024
1 parent 5de635f commit 0d13eb2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions ql/time/date.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,19 @@ namespace QuantLib {

#endif

#ifndef QL_HIGH_RESOLUTION_DATE
// inline definitions

inline Date Date::startOfMonth(const Date& d) {
Month m = d.month();
Year y = d.year();
return Date(1, m, y);
}

inline bool Date::isStartOfMonth(const Date& d) {
return (d.dayOfMonth() == 1);
}

#ifndef QL_HIGH_RESOLUTION_DATE
inline Weekday Date::weekday() const {
Integer w = serialNumber_ % 7;
return Weekday(w == 0 ? 7 : w);
Expand Down Expand Up @@ -429,16 +439,6 @@ namespace QuantLib {
return advance(*this,-p.length(),p.units());
}

inline Date Date::startOfMonth(const Date& d) {
Month m = d.month();
Year y = d.year();
return Date(1, m, y);
}

inline bool Date::isStartOfMonth(const Date& d) {
return (d.dayOfMonth() == 1);
}

inline Date Date::endOfMonth(const Date& d) {
Month m = d.month();
Year y = d.year();
Expand Down

1 comment on commit 0d13eb2

@igitur
Copy link
Contributor

@igitur igitur commented on 0d13eb2 Jul 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw some of the builds were failing and still wanted to look at this. Thanks.

Please sign in to comment.