Skip to content

Implemented the stream operator<< for type datetime #1314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ René Meusel (reneme)

Sony Corporation
Gareth Sylvester-Bradley (garethsb-sony)

Cubeware GmbH
Peter Brockamp (pbrcw)
14 changes: 10 additions & 4 deletions Release/include/cpprest/asyncrt_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,13 +628,13 @@ class datetime
bool operator==(datetime dt) const { return m_interval == dt.m_interval; }

bool operator!=(const datetime& dt) const { return !(*this == dt); }

bool operator>(const datetime& dt) const { return this->m_interval > dt.m_interval; }

bool operator<(const datetime& dt) const { return this->m_interval < dt.m_interval; }

bool operator>=(const datetime& dt) const { return this->m_interval >= dt.m_interval; }

bool operator<=(const datetime& dt) const { return this->m_interval <= dt.m_interval; }

static interval_type from_milliseconds(unsigned int milliseconds) { return milliseconds * _msTicks; }
Expand Down Expand Up @@ -665,6 +665,12 @@ class datetime
interval_type m_interval;
};

inline ::utility::ostream_t & operator<< (::utility::ostream_t & out, datetime const & data)
{
out << data.to_string();
return out;
}

inline int operator-(datetime t1, datetime t2)
{
auto diff = (t1.m_interval - t2.m_interval);
Expand Down