logic: Added weekday condition to news API
This commit is contained in:
@@ -49,6 +49,26 @@ std::string TimeStamp::getDDMMYYYYString() const
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
std::string TimeStamp::dayOfWeek() const
|
||||
{
|
||||
switch (m_time.date().day_of_week())
|
||||
{
|
||||
case 0: return "Sunday";
|
||||
case 1: return "Monday";
|
||||
case 2: return "Tuesday";
|
||||
case 3: return "Wednesday";
|
||||
case 4: return "Thursday";
|
||||
case 5: return "Friday";
|
||||
case 6: return "Saturday";
|
||||
}
|
||||
return "none";
|
||||
}
|
||||
|
||||
std::string TimeStamp::dayOfWeekShort() const
|
||||
{
|
||||
return dayOfWeek().substr(0, 3);
|
||||
}
|
||||
|
||||
size_t TimeStamp::deltaMS(const TimeStamp& other) const
|
||||
{
|
||||
return abs((m_time - other.m_time).total_milliseconds());
|
||||
|
||||
@@ -16,6 +16,8 @@ public:
|
||||
|
||||
std::string toString() const;
|
||||
std::string getDDMMYYYYString() const;
|
||||
std::string dayOfWeek() const;
|
||||
std::string dayOfWeekShort() const;
|
||||
|
||||
inline bool operator==(const TimeStamp& rhs) { return m_time == rhs.m_time; }
|
||||
inline bool operator!=(const TimeStamp& rhs) { return m_time != rhs.m_time; }
|
||||
|
||||
Reference in New Issue
Block a user